User Tools

Site Tools


backup_on_freebsd

Sul server ks:

root@ks****:/etc # cat crontab
# /etc/crontab - root's crontab for FreeBSD
#
# $FreeBSD: releng/11.3/etc/crontab 342103 2018-12-14 21:30:34Z imp $
#
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
#
#minute	hour	mday	month	wday	who	command
#
*/5	*	*	*	*	root	/usr/libexec/atrun
#
# Save some entropy so that /dev/random can re-seed on boot.
*/11	*	*	*	*	operator /usr/libexec/save-entropy
#
# Rotate log files every hour, if necessary.
0	*	*	*	*	root	newsyslog
#
# Perform daily/weekly/monthly maintenance.
1	3	*	*	*	root	periodic daily
15	4	*	*	6	root	periodic weekly
30	5	1	*	*	root	periodic monthly
#
# Adjust the time zone if the CMOS clock keeps local time, as opposed to
# UTC time.  See adjkerntz(8) for details.
1,31	0-5	*	*	*	root	adjkerntz -a


0 1 * * * root /usr/local/bin/dokuwiki.sh

45 13 * * * root /usr/local/bin/dokuwiki_brigitta.sh

0 3 1 * * root /usr/local/bin/dokuwiki_completa.sh

0 5 1 * * root /usr/local/bin/backup_usr_local_etc.sh

root@ks3367031:~ # ls -lh /usr/local/bin/ doku*
ls: No match.
root@ks3367031:~ # ls -lh /usr/local/bin/doku*
-rwxr-xr-x  1 root  wheel   201B Feb  7  2019 /usr/local/bin/dokuwiki.sh
-rwxr-xr-x  1 root  wheel   182B Feb  7  2019 /usr/local/bin/dokuwiki_brigitta.sh
-rwxr-xr-x  1 root  wheel   192B Feb  9  2019 /usr/local/bin/dokuwiki_completa.sh
root@ks3367031:~ # cat /usr/local/bin/dokuwiki.sh
#!/bin/sh
# Lo faccio eseguire da cron ogni sera.
# Cf. /etc/crontab

present=`date +'%j_%Y'`

tar --exclude=/usr/local/www/dokuwiki/data/cache -cvzf /home/francesco/bkk/DokuWiki_$present.tar.gz /usr/local/www/
root@ks3367031:~ # cat /usr/local/bin/dokuwiki_brigitta.sh 
#!/bin/sh
# Lo faccio eseguire da cron ogni sera alle 20.

present=`date +'%j_%Y'`

tar -cvzf /home/francesco/bkk/DokuWiki_Brigitta_$present.tar.gz /usr/local/www/animals/brigitta/
root@ks3367031:~ # cat /usr/local/bin/dokuwiki_completa.sh 
#!/bin/sh
# Lo faccio eseguire da cron il primo giorno di ogni mese alle 3 di notte.

present=`date +'%j_%Y'`

tar -cvzf /home/francesco/bkk/DokuWiki_completa_$present.tar.gz /usr/local/www/

Dal NUC (non è necessario essere root):

$ crontab -e

# @reboot /usr/home/francesco/syncthing-freebsd-amd64-v1.1.0/./syncthing

0 5 * * * /usr/local/bin/dokuwiki_NUC.sh

0 15 * * * /usr/local/bin/dokuwiki_brigitta_NUC.sh
$ ls -lh /usr/local/bin/doku*
-rwxr-xr-x  1 francesco  francesco   169B Mar 31  2019 /usr/local/bin/dokuwiki_NUC.sh
-rwxr-xr-x  1 francesco  francesco   178B Mar 31  2019 /usr/local/bin/dokuwiki_brigitta_NUC.sh
$ cat /usr/local/bin/dokuwiki_NUC.sh
#!/bin/sh
# Lo faccio eseguire da cron ogni mattina alle 5.

present=`date +'%j_%Y'`

rsync ks:/home/francesco/bkk/DokuWiki_$present.tar.gz /home/francesco/bkk_dokuwiki
$ cat /usr/local/bin/dokuwiki_brigitta_NUC.sh 
#!/bin/sh
# Lo faccio eseguire da cron ogni mattina alle 5.

present=`date +'%j_%Y'`

rsync ks:/home/francesco/bkk/DokuWiki_Brigitta_$present.tar.gz /home/francesco/bkk_dokuwiki
backup_on_freebsd.txt · Last modified: 2020/04/19 22:11 by francesco