Showing posts with label cron. Show all posts
Showing posts with label cron. Show all posts

Friday, March 12, 2010

Sync music/podcasts to mobile phone

Essentially use rsync to sync folders between multiple machines which in this case the host machine with the music files and the mobile phone storage.

rsync ~/Music /media/disk/Music -rP
For podcasts it'll be a good idea to use cronjob to download new podcasts. I'm using a remote server to download them.

# On my remote server

sudo apt-get install podget

# crontab -e on server
0 * * * * /usr/bin/podget -s

# On my local host machine with mobile phone plugged in

rsync username@remote-server:./Music/Podcasts /media/disk/Podcasts -rP

Sunday, March 7, 2010

Running ruby scripts as cron jobs in rvm environment


# This will fail to run properly

*/5 * * * * /usr/bin/env ruby /home/username/twitter.rb

# Need to run the script in full bash environment

*/5 * * * * bash -c 'source /home/username/.rvm/scripts/rvm && /usr/bin/env ruby /home/username/twitter.rb'

Cron log in Ubuntu

* Edit /etc/syslog.conf and uncomment the line starting with cron.*
* touch /var/log/cron.log
* Run /etc/init.d/rsyslog restart
* Run /etc/init.d/cron restart