Closed GoogleCodeExporter closed 8 years ago
I'll need to find a way to detach a process from the script so that update runs
smoothly.
Update process would then be :
Detect current build of the script
Use wget or curl to download the latest build and check it against the current
one
If more recent, detach a process that would inject content of the new script to
the current one.
Of course right after detaching this process we would exit torrentexpander.sh
This way we wouldn't have to deal with permissions...
... but I have no idea right now on how to do all that (especially the detach
part)
Original comment by addicted...@gmail.com
on 28 Nov 2011 at 8:02
Dirty code for NMT PLATFORM
$crontab=/etc/cront/root.cron
$path_torrentexpander_update_script=/share/Apps/Transmission/bin/torrentexpander
_update.sh
if [[ $auto_update == "yes" ]]; then
already_planned = crontab -l | grep torrentexpander
if [[ $already_planned == "" ]]; then
echo '@reboot $path_torrentexpander_update_script >> $crontab'
fi
fi
if [[ $auto_update == "no" ]]; then
cat $crontab | sed 'g/@reboot $path_torrentexpander_update_script//s > $crontab
fi
Original comment by login...@gmail.com
on 29 Nov 2011 at 11:23
Thanks for this
I'll do some tweaking... I'd really like to include auto update in the script
without using cron
Original comment by addicted...@gmail.com
on 29 Nov 2011 at 10:13
Another ideas:
torrentexpander create a script to autoupdating himself; it run
torrentexpander_update.sh and ends.
torrentexpander_update.sh take some time to ping google (we could use to very
connection aslo!) while main program ends.
Then the update starts.
if [[ $auto_update == "yes" && $is_outdated == "yes" ]]; then
echo "#!/bin/sh
ping -w 10 google.it;
wget -o torrentexpander.sh http://torrentexpander.googlecode.com/svn/trunk/torrentexpander.sh
chmod +x torrentexpander.sh
" > torrentexpander_update.sh
chmod +x torrentexpander_update.sh
./torrentexpander_update.sh
fi
Original comment by login...@gmail.com
on 1 Dec 2011 at 10:06
I had something similar in mind
I'm pretty sure we can do this without creating a new script (on other
platforms than the NMT, chmod +x may not work)
We can use something like screen to launch a command in a parallel process.
This update routine will be at the beginning of the script, right after
torrentexpander knows what the torrent source and destination are.
This command will start by a 1 second pause, torrentexpander will exit,
torrentexpander will be rewritten with the latest version of the script, then
be relaunched with the path to the source and destination.
We'll use the settings to store current version of the script and the last
updated at
In order not to have to increment version number of the script, I'll also try
to parse this page for the SVN revision number
http://code.google.com/p/torrentexpander/source/browse/trunk
Thanks
Original comment by addicted...@gmail.com
on 2 Dec 2011 at 9:40
Current SVN release has auto update built-in
Script will update daily, weekly, monthly or never, based on your settings.
In the future I may need to add a branch to the project so that the trunk
release is exempt of any bug
Original comment by addicted...@gmail.com
on 3 Dec 2011 at 5:26
Thanks for this, but look issue 26
Original comment by login...@gmail.com
on 3 Dec 2011 at 5:51
New SVN build
I'm using a temp text file instead of a variable to store the new script
My NMT fucks up right now so I can't test it
Also, I added support for vi text editor, so you can directly edit your
settings by using /path/to/torrentexpander.sh -c
Let me know if it works for you
Original comment by addicted...@gmail.com
on 4 Dec 2011 at 12:53
Excellent
Original comment by login...@gmail.com
on 4 Dec 2011 at 10:53
Original comment by login...@gmail.com
on 4 Dec 2011 at 10:54
Original issue reported on code.google.com by
login...@gmail.com
on 27 Nov 2011 at 10:53