2019-07-27 03:12:28 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Set values in settings script
|
|
|
|
|
|
|
|
echo "#################################"
|
|
|
|
echo " UPDATING CRONTAB"
|
|
|
|
echo "#################################"
|
|
|
|
|
|
|
|
|
|
|
|
# Remove existing crontab
|
|
|
|
echo "Backup existing crontab"
|
|
|
|
crontab -l > crontab
|
|
|
|
|
|
|
|
echo "Removing exiting crontab"
|
|
|
|
crontab -r
|
|
|
|
|
2019-08-05 19:45:14 +03:00
|
|
|
# Define env path
|
|
|
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/games:/snap/bin:/bin/:$_WORK_DIR
|
|
|
|
|
2019-07-27 03:12:28 +03:00
|
|
|
# Setup users contab
|
|
|
|
crontab -l | { cat; echo "#Start at $_USER_TIMESTART on days $_USER_CRONDAYS
|
2019-08-05 19:45:14 +03:00
|
|
|
0 $_USER_CRONSTART * * $_USER_CRONDAYS bash start.sh"; } | crontab -
|
2019-07-27 03:12:28 +03:00
|
|
|
|
|
|
|
crontab -l | { cat; echo "#Stop at $_USER_TIMESTOP on days $_USER_CRONDAYS
|
2019-08-05 19:45:14 +03:00
|
|
|
0 $_USER_CRONSTOP * * $_USER_CRONDAYS bash stop.sh"; } | crontab -
|
|
|
|
|
2019-07-27 03:12:28 +03:00
|
|
|
|
|
|
|
crontab -l
|
|
|
|
|
|
|
|
echo "#################################"
|
|
|
|
echo " CRONTAB UPDATED"
|
|
|
|
echo "#################################"
|
|
|
|
|