0

I used crontab -e, getting the below, which I then edited (adding the final line):

# Edit this file to introduce tasks to be run by cron.
# 
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
# 
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').# 
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# 
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# 
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# 
# For more information see the manual pages of crontab(5) and cron(8)
# 
# m h  dom mon dow   command

@reboot guake

But guake still doesn't run on startup. Why? I also tried @reboot ./script, and the script won't run. Both work in the terminal usually.

apg
  • 255
  • 2
  • 12
  • Where is the `guake` binary? cron jobs run with a minimal `PATH`, so binaries anywhere except /bin or /usr/bin will not be found. Can `guake` run before you've logged in? Does it have any other environment dependencies (cron jobs run with a very minimal environment)? Have you tried capturing its output (and errors) by adding something like `>/tmp/guake.log 2>&1` to the command? Check the [canonical question over on ServerFault](https://serverfault.com/questions/449651/why-is-my-crontab-not-working-and-how-can-i-troubleshoot-it) for more ideas. – Gordon Davisson Mar 08 '20 at 07:43
  • I just want to run guake on startup. This is what the guide said to do. – apg Mar 08 '20 at 07:45
  • Which guide? I tried googling, but didn't see anything relevant. – Gordon Davisson Mar 08 '20 at 07:48
  • Second answer here https://askubuntu.com/questions/814/how-to-run-scripts-on-start-up – apg Mar 08 '20 at 07:50
  • 2
    That's talking about shell scripts, not interactive GUI programs. (And it's common for shell scripts to fail due to cron's minimal environment.) Try the answers to: [How to make Guake start at login?](https://askubuntu.com/questions/368705/how-to-make-guake-start-at-login) – Gordon Davisson Mar 08 '20 at 08:17
  • I also tried a shell script called "view" using the line ./view. How do I just run a command at start up, without first opening a terminal and running it? For example, I have a script "view" which alters my monitor resolution. It is in my home folder. I just run ./view. But I need it to run automatically. – apg Mar 08 '20 at 08:21
  • It really depends on what the script/program does, what its dependencies are, etc. The options in that other question are much more likely to work, but there's no single always-works answer. – Gordon Davisson Mar 08 '20 at 08:42

0 Answers0