OrkoHunter / ping-me

A cross platform personalized Ping
Apache License 2.0
192 stars 21 forks source link

Use crontab instead of ad-hoc `nohup` #22

Closed OrkoHunter closed 8 years ago

OrkoHunter commented 8 years ago

So, after some really great time spent in understanding the procedure, we're finally using crontab ! It's smooth and easy to use.

Usage instructions :

  1. Install : $ pip install ping-me
  2. Edit crontab file : $ crontab -e
  3. Add the following 3 lines
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DISPLAY=:0.0

* * * * * get-ping
  1. Save and exit. That's it :)

Some explanation :

  1. cron actually does not have all the paths in its $PATH variable. Hence we need to add custom locations in the PATH variable.
  2. Each host can have multiple displays, and each display can have multiple screens. Hence we need to specify the screen used by notify-send. (This one took a lot of debugging)
  3. The get-ping script searches for a ping in the next minute.