2

I have tried to make this task for abacron:

dm@dm-system:~$ cat /etc/anacrontab 
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOME=/root
LOGNAME=root

# These replace cron's entries
1   5   cron.daily  run-parts --report /etc/cron.daily
7   10  cron.weekly run-parts --report /etc/cron.weekly
@monthly    15  cron.monthly    run-parts --report /etc/cron.monthly
@daily 5 /home/dm/Devel/btsync && notify-send "Btsync loaded (pid `pidof btsync`)" "Link <a href='http://0.0.0.0:8888/gui/'>here</a>."

this command well done from my xubuntu terminal

/home/dm/Devel/btsync && notify-send "Btsync loaded (pid `pidof btsync`)" "Link <a href='http://0.0.0.0:8888/gui/'>here</a>."

but when i started my notebook i saw in /var/syslog:

Aug 14 10:49:06 dm-system anacron[904]: Anacron 2.3 started on 2014-08-14
Aug 14 10:49:06 dm-system anacron[904]: Invalid syntax in /etc/anacrontab on line 14 - skipping this line
Aug 14 10:49:06 dm-system cron[841]: (CRON) INFO (pidfile fd = 3)
Aug 14 10:49:06 dm-system cron[998]: (CRON) STARTUP (fork ok)
Aug 14 10:49:06 dm-system cron[998]: (CRON) INFO (Running @reboot jobs)
Aug 14 10:49:07 dm-system anacron[904]: Will run job `cron.daily' in 5 min.
Aug 14 10:49:07 dm-system anacron[904]: Jobs will be executed sequentially
Aug 14 10:54:04 dm-system anacron[904]: Job `cron.daily' started
Aug 14 10:54:05 dm-system anacron[2616]: Invalid syntax in /etc/anacrontab on line 14 - skipping this line
Aug 14 10:54:05 dm-system anacron[2616]: Updated timestamp for job `cron.daily' to 2014-08-14
4

The syntax of anacrontab is, according to the manpage:

Job-description lines are of one of these two forms:

      period  delay  job-identifier  command

      @period_name delay job-identify command

I'd say you are missing a job-identifier. So something like;

@daily 5 btsync-job /home/dm/Devel/btsync && notify-send "Btsync loaded (pid `pidof btsync`)" "Link <a href='http://0.0.0.0:8888/gui/'>here</a>."

Also, the manpage notes that, as of now, @period_name can only be @monthly. So instead of @daily, one would have to use:

1 5 btsync-job /home/dm/Devel/btsync && notify-send "Btsync loaded ...

Aside from this, notify-send would need the DISPLAY variable to be set. This is typically :0, but you can check using echo $DISPLAY in a terminal. Thus the anacrontab entry should look like:

DISPLAY=:0
1 5 btsync-job /home/dm/Devel/btsync && notify-send "Btsync loaded ...
6
  • options '@daily' not working. work if instead of '@daily' type 1 and job start, but not showing message (in this way and with /usr/bin/notify-send)
    – dmgl
    Aug 15 '14 at 8:53
  • @blackbird- you're right. According to the manpage, "The period_name can only be set to monthly at the present time. "
    – muru
    Aug 15 '14 at 8:54
  • ok (command $ anacron -T - helped me give message /etc/anacrontab: Unknown named period on line 14, skipping) but why notify-send wasn't word at all?
    – dmgl
    Aug 15 '14 at 9:06
  • from cron job ' @reboot sleep 300 && /home/dm/Devel/btsync && /usr/bin/notify-send "Btsync loaded (pid pidof btsync)" "Link <a href='0.0.0.0:8888/gui/'>here</a>." ' doesn't show message too
    – dmgl
    Aug 15 '14 at 9:12
  • @blackbird- did you set the display variable, since notify-send uses the GUI? See askubuntu.com/a/92195/158442
    – muru
    Aug 15 '14 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.