Score:0

cannot run command on startup using crontab

it flag

I want to run a command at startup using crontab (or any other alternative but I do not know other alternatives).

I do the following:

  1. crontab -e
  2. @reboot /usr/bin/ulauncher --hide-window > /dev/null 2>&1 &
  3. I restart and the command did not run (the program did not open).
  4. Tried to check ps -aux | grep -i cron and the result is root 1127 0.0 0.0 57036 3280 ? Ss 17:42 0:00 /usr/sbin/cron -f which means that crontab is not running as the current user, thus I though this is the issue but I am not sure whether it is the issue or not and how to resolve it.
sudodus avatar
jp flag
I think you should tell ulauncher which display to use: try with `env DISPLAY=:0 ` in the command line before `/usr/bin/ulauncher ...`; check the correct value of the DISPLAY environment variable in your particular case. - An alternative is to use the autostart feature: create a desktop file and put it into your autostart directory.
hr flag
It should be obvious... but if you want to know *why* a cronjob is failing, **don't** redirect its output and error streams to `/dev/null` - redirect them to a log file that you can examine after
Omar Shawky avatar
it flag
@steeldriver, that is a redirect to ulauncher output not crontab.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.