Mr.Macdonald
October 5th, 2008, 07:11 PM
I have recently setup a server and now would like to have cron ssh my data over there. I set this up but it isn't executing?? and the log is empty
I was opening the crontab for root via these commands (ls -l, just showing the files there)
aidan@aidan-desktop:/etc/cron.d$ ls -l
total 8
-rw-r--r-- 1 root root 244 2007-03-04 22:38 anacron
-rw-r--r-- 1 root root 0 2008-09-25 23:00 archive.log
-rwxr-xr-x 1 root root 732 2008-09-24 20:53 archive.sh
aidan@aidan-desktop:/etc/cron.d$ su
Password:
root@aidan-desktop:/etc/cron.d# crontab -e
Heres the crontab
# m h dom mon dow command
0 23 * * 0,4 sudo /etc/cron.d/archive.sh >> /etc/cron.d/archive.log
and heres /etc/cron.d/archive.sh
#!/bin/bash
#EDU
tar jcf - /home/aidan/edu | ssh 192.168.15.101 "cat > /home/aidan/edu`date +%F`.tar.bz2"
ssh root@192.168.15.101 "ls /home/aidan/edu*.tar.bz2 | grep -v \"`ls /home/aidan/edu*.tar.bz2 | tail -2`\" > /tmp/arch.ssh; rm -f `cat arch.ssh`"
#PROGS
tar jcf - /home/aidan/progs | ssh 192.168.15.101 "cat > /home/aidan/progs`date +%F`.tar.bz2"
ssh root@192.168.15.101 "ls /home/aidan/progs*.tar.bz2 | grep -v \"`ls /home/aidan/progs*.tar.bz2 | tail -2`\" > /tmp/arch.ssh; rm -f `cat /tmp/arch.ssh`"
#DATA
tar jcf - /data | ssh 192.168.15.101 "cat > /data/data`date +%F`.tar.bz2"
ssh root@192.168.15.101 "ls /data/data*.tar.bz2 | grep -v \"`ls /data/data*.tar.bz2 | tail -2`\" > /tmp/arch.ssh; rm -f `cat /tmp/arch.ssh`"
Thank you
I was opening the crontab for root via these commands (ls -l, just showing the files there)
aidan@aidan-desktop:/etc/cron.d$ ls -l
total 8
-rw-r--r-- 1 root root 244 2007-03-04 22:38 anacron
-rw-r--r-- 1 root root 0 2008-09-25 23:00 archive.log
-rwxr-xr-x 1 root root 732 2008-09-24 20:53 archive.sh
aidan@aidan-desktop:/etc/cron.d$ su
Password:
root@aidan-desktop:/etc/cron.d# crontab -e
Heres the crontab
# m h dom mon dow command
0 23 * * 0,4 sudo /etc/cron.d/archive.sh >> /etc/cron.d/archive.log
and heres /etc/cron.d/archive.sh
#!/bin/bash
#EDU
tar jcf - /home/aidan/edu | ssh 192.168.15.101 "cat > /home/aidan/edu`date +%F`.tar.bz2"
ssh root@192.168.15.101 "ls /home/aidan/edu*.tar.bz2 | grep -v \"`ls /home/aidan/edu*.tar.bz2 | tail -2`\" > /tmp/arch.ssh; rm -f `cat arch.ssh`"
#PROGS
tar jcf - /home/aidan/progs | ssh 192.168.15.101 "cat > /home/aidan/progs`date +%F`.tar.bz2"
ssh root@192.168.15.101 "ls /home/aidan/progs*.tar.bz2 | grep -v \"`ls /home/aidan/progs*.tar.bz2 | tail -2`\" > /tmp/arch.ssh; rm -f `cat /tmp/arch.ssh`"
#DATA
tar jcf - /data | ssh 192.168.15.101 "cat > /data/data`date +%F`.tar.bz2"
ssh root@192.168.15.101 "ls /data/data*.tar.bz2 | grep -v \"`ls /data/data*.tar.bz2 | tail -2`\" > /tmp/arch.ssh; rm -f `cat /tmp/arch.ssh`"
Thank you