no cron script running ? #46

Closed
opened 2022-05-03 16:52:02 +00:00 by pheremans · 2 comments
Owner
# id                                                                               ~ aircox 18:49
uid=0(root) gid=0(root) groups=0(root)
# crontab -l                                                                       ~ aircox 18:49
no crontab for root
# sudo su - aircox                                                                 ~ aircox 18:49
$ id
uid=999(aircox) gid=999(aircox) groups=999(aircox),29(audio),33(www-data)
$ crontab -l
no crontab for aircox

je configure le cron (cfr #10 ) pour l'utilisateur aircox

``` # id ~ aircox 18:49 uid=0(root) gid=0(root) groups=0(root) # crontab -l ~ aircox 18:49 no crontab for root # sudo su - aircox ~ aircox 18:49 $ id uid=999(aircox) gid=999(aircox) groups=999(aircox),29(audio),33(www-data) $ crontab -l no crontab for aircox ``` je configure le cron (cfr #10 ) pour l'utilisateur aircox
pheremans added the
backend
gnuragistes
labels 2022-05-03 16:52:02 +00:00
Author
Owner
$ cd /srv/www/aircox/scripts
$ cat cron
#! /bin/sh

# aircox daily tasks:
# - diffusions monitoring for the current month
cd /srv/apps/aircox/
scripts/launch_in_venv ./manage.py diffusions --update --clean
# - diffusions monitoring for the next month
scripts/launch_in_venv ./manage.py diffusions --update --next-month
cd -

# - archiver monitoring for the next month
scripts/launch_in_venv ./manage.py archiver
cd -

check if this script is executable

$ ls -alh /srv/www/aircox/scripts/cron
-rwxr-xr-x 1 root root 379 May 30  2020 /srv/www/aircox/scripts/cron

edit crontab for aircox user

sudo su - aircox
crontab -e

run the script every day at 1h00

0 1 * * * /srv/www/aircox/scripts/cron
``` $ cd /srv/www/aircox/scripts $ cat cron #! /bin/sh # aircox daily tasks: # - diffusions monitoring for the current month cd /srv/apps/aircox/ scripts/launch_in_venv ./manage.py diffusions --update --clean # - diffusions monitoring for the next month scripts/launch_in_venv ./manage.py diffusions --update --next-month cd - # - archiver monitoring for the next month scripts/launch_in_venv ./manage.py archiver cd - ``` check if this script is executable ``` $ ls -alh /srv/www/aircox/scripts/cron -rwxr-xr-x 1 root root 379 May 30 2020 /srv/www/aircox/scripts/cron ``` edit crontab for aircox user ``` sudo su - aircox crontab -e ``` run the script every day at 1h00 ``` 0 1 * * * /srv/www/aircox/scripts/cron ```
Author
Owner

changed the script to use correct installation directories (which differ from default one)

#! /bin/sh

# aircox daily tasks:
# - diffusions monitoring for the current month
cd /srv/www/aircox/
scripts/launch_in_venv ./manage.py diffusions --update --clean
# - diffusions monitoring for the next month
scripts/launch_in_venv ./manage.py diffusions --update --next-month

# - archiver monitoring for the next month
scripts/launch_in_venv ./manage.py archiver
cd -
changed the script to use correct installation directories (which differ from default one) ``` #! /bin/sh # aircox daily tasks: # - diffusions monitoring for the current month cd /srv/www/aircox/ scripts/launch_in_venv ./manage.py diffusions --update --clean # - diffusions monitoring for the next month scripts/launch_in_venv ./manage.py diffusions --update --next-month # - archiver monitoring for the next month scripts/launch_in_venv ./manage.py archiver cd - ```
Sign in to join this conversation.
No description provided.