This will sync any attached iPods if iTunes is running:
#!/bin/sh osascript <<_END_OF_UPDATE tell application "Finder" set processList to get name of every process if processList contains "iTunes" then tell application "iTunes" to update (every source whose kind is iPod) end if end tell _END_OF_UPDATE
It can be called from a cronjob to keep an iPod updated. iTunes ought to just do this automatically.