2

Good afternoon, I'm trying to edit by soft, as a text file, the file that contains the crontab data. This is because I need to execute a series of functions daily, they are related to the sunrise and sunset, which vary from day to day. The idea is to generate today the crontab file, with the morning schedule, save it and tomorrow when the system starts it will do so with the corresponding data. I can not find the file, and what I find the system does not allow me to edit ...

Thank you

4

If you want to run cron jobs with start times relative to sun up/down or twilight then you could use sunwait It will determine the correct time to wait, based on your location's coordinates.

Simple example running echo 1 hour before sunrise:

 # m h  dom mon dow   command
 01 00   *   *   *  /usr/local/bin/sunwait sun up -1:00:00 52.518N 1.475W; /bin/echo "hello"
0

The crontab files are located at /var/spool/cron/crontabs/ You will need to be root to access them, e.g. sudo su cd /var/spool/cron/crontabs leafpad pi

Be aware that if you make any mistakes, that particular crontab will no longer function.

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.