Site-Update-Script/setup.sh

15 lines
408 B
Bash
Raw Normal View History

2020-03-04 14:20:33 -05:00
#!/bin/bash
USER=$(whoami)
CRON_DIR=/var/spool/cron/$USER
CRON_JOB="0 0 * * * /home/$USER/update_page.sh" # a simple cron job that runs everyday
# allow user to add cron commands
sudo echo $USER >> /etc/cron.allow
# setup a cron file for the user
sudo touch $CRON_DIR
sudo /usr/bin/crontab $CRON_DIR
# setup the cron job
sudo echo $CRON_JOB >> $CRON_DIR
echo "Checking cronjobs..."
sudo crontab -u $USER -l