random/crontab-bk.sh

16 lines
436 B
Bash
Raw Normal View History

2022-06-26 22:34:06 -05:00
#!/bin/sh
# this is a script to backup crontab data
2022-09-17 22:09:56 -05:00
2022-06-26 22:34:06 -05:00
# put this inside /etc/cron.daily
# define location for output
DIR=/home/sintan/Documents/Backup/pkglists
# make sure that the folder exists
mkdir -p $DIR
ls /etc/cron.hourly/ /etc/cron.daily/ /etc/cron.weekly/ /etc/cron.monthly/ > $DIR/crontab
echo "-----------------" >> $DIR/crontab
2022-09-17 22:09:56 -05:00
find /var/spool/cron/ -type f -exec sh -c "echo {} && cat {} && echo ---" \; >> $DIR/crontab