I am not sure if that would be nice, can you imagine if you had to w8 for 1Gb of files to be synced before shutdown? Doesn't it make more sense that the close signals are sent to the programs so they can quit and if there is further work then it can be resumed on after booting again.
Even Windows only allows 30 secs before it forces close on programs for shutdown.
I really don't see how can this be useful! If I order a shutdown I want that thing closed asap and boot up asap, not wait for the programs to do idontknowwhat. After all, it was my responsibility that started the shutdown, I should know when its a good time or not.
Edit (read all the comments bellow!):
Here is the script that checks the current status of UbuntuOne and shuts down only when status is idle.
while true; do
u1sdtool_status=$(u1sdtool --status | grep -o 'queues: IDLE')
if [ "$u1sdtool_status" = "queues: WORKING" -o "$u1sdtool_status" = "queues: WORKING_ON_BOTH" ]; then
echo "$timestamp - UbuntuOne has not finished sync, waiting for conclusion."
echo "Re-checking in 30 seconds."
elif [ "$u1sdtool_status" = "queues: IDLE" ]; then
if [ $gracetime_given = false ]; then
echo "u1sdtools seems to be idle at the moment..."
echo "Giving u1sdtool some grace time, rechecking in 10 seconds."
echo "This is where you shutdown!!!"
sudo shutdown -h now
echo "Something is really wrong!!!"
To use it you need to do the following, on the terminal you need to use
sudo visudo and add this line at the end of the file
<yourusername> hostname=NOPASSWD: /sbin/shutdown -h now so that no password is necessary to shutdown your computer using account.
After that you need to save the script anywhere (), you need to use
chmod 755 <nameofthescript.sh> to make it executable.
Then you can just run the scrip and see how it works:
- gets the current status of UbuntuOne
- if not idle re-checks to see if its idle every 30 secs
- if idle will give it 10 more secs and recheck if the status is still idle
- if it is still idle it will shutdown using
shutdown -h now
Hope this works and comment as you want on the code as long as you understand that this is actually my very first bash script!
Gl and hf ;)