Created
June 24, 2010 09:03
-
-
Save alx/451195 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#### CONFIGURE #### | |
# Configure crontab, by hand until someone script it: | |
# crontab -e | |
# 15 03 * * * sh $HOME/.cron.daily/backup.sh | |
# */5 * * * * sh $HOME/.cron.5m/lifestream.sh | |
# ssh account | |
export SSHACCOUNT=alex | |
export SSHSERVER=tetalab.org | |
# You'll need to configure your ssh key for automatic login during night backup | |
# ssh-keygen -t rsa | |
# ssh $SSHACCOUNT@$SSHSERVER 'mkdir -p .ssh' | |
# cat .ssh/id_rsa.pub | ssh $SSHACCOUNT@$SSHSERVER 'cat >> .ssh/authorized_keys' | |
#### Just for your eyes #### | |
# Create folders | |
mkdir $HOME/bin | |
mkdir $HOME/.cron.5m | |
mkdir $HOME/.cron.daily | |
mkdir $HOME/lifestream | |
ssh $SSHACCOUNT@$SSHSERVER 'mkdir webcam; chmod 700 webcam' | |
# Add isightcapture to $HOME/bin | |
curl http://tetalab.org/isightcapture -o $HOME/bin/isightcapture | |
chmod +x $HOME/bin/isightcapture | |
# include $HOME/bin in PATH | |
export PATH=$PATH:$HOME/bin | |
# Create cron.5m to capture isight every 5 min | |
touch $HOME/.cron.5m/lifestream.sh | |
cat > $HOME/.cron.5m/lifestream.sh << EOF | |
#!/bin/bash -ex | |
DATE=`date +%s` | |
$HOME/bin/isightcapture $HOME/lifestream/webcam_$DATE.jpeg | |
EOF | |
# Create cron.daily to archive webcam every night | |
touch $HOME/.cron.daily/backup.sh | |
cat > $HOME/.cron.daily/backup.sh << EOF | |
#!/bin/bash -ex | |
DATE=`date +%s` | |
tar -czvf $HOME/lifestream/webcam_$DATE.tar.gz $HOME/lifestream/webcam_*.jpeg | |
scp $HOME/lifestream/webcam_$DATE.tar.gz $SSHACCOUNT@$SSHSERVER:webcam/ | |
rm $HOME/lifestream/webcam_* | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment