0

my script:

#!/bin/sh
PATH=$PATH:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
if pgrep -x  "firefox" >/dev/null
then
    return
else
    firefox &
fi

my crontab:

* * * * * /home/jesuscrew77/sc.sh

It runs manually but doesn't start with crontab. what is wrong?

3
  • firefox being a graphical browser, it's likely missing a $DISPLAY
    – Jeff Schaller
    Commented Jul 20, 2019 at 12:12
  • can you confirm via the cron logs that the cron job is, indeed, firing or not?
    – Jeff Schaller
    Commented Jul 20, 2019 at 12:12
  • @JeffSchaller yes it'is firing Jul 20 15:17:01 jesuscrew77 CRON[6277]: (jesuscrew77) CMD (export DISPLAY=:0 /home/jesuscrew77/sc.sh) did i correctly add DISPLAY? Commented Jul 20, 2019 at 12:18

0

Browse other questions tagged .