Code: Select all
#!/bin/bash
megasync
dropbox start -i
shutdown
Code: Select all
#!/bin/bash
megasync
dropbox start -i
shutdown
I don't see why it wouldn't work (disclaimer: dunno anything about dropbox). I do something similar:cecilieaux wrote: ⤴Thu Feb 25, 2021 11:30 am Trying to turn on the sync software for two cloud sites, so that new items get saved to the cloud before shutting down. I'm thinking something like
Would that work? I'm very new at this. Please don't bash me (pun intended).Code: Select all
#!/bin/bash megasync dropbox start -i shutdown
Code: Select all
# mute audio and poweroff
amixer set 'Master',0 25% mute
/bin/systemctl poweroff -i
I found out that there's a commandline version of megasync, megatools, which has specific parameters to do what I am proposing. Dropbox comes with a command line interface.
My concern might be that they start something in background and it gets interrupted.cecilieaux wrote: ⤴Thu Feb 25, 2021 12:31 pm I found out that there's a commandline version of megasync, megatools, which has specific parameters to do what I am proposing. Dropbox comes with a command line interface.
Yes, that's my worry, too. Damn! I need a command for synching for each one. I need them to synch, then shut down.
OK, tried it. Megasync wouldn't turn off by itself and the shutdown hung until I clicked it shut. So, I did this:
Code: Select all
#!/bin/bash
megasync
dropbox start -i
time -300 -p
dropbox stop
killall -9 megasync
cinnamon-session-quit --power-off
Code: Select all
bash -c "megasync && dropbox start -i && shutdown"
Code: Select all
bash -c "megasync && dropbox start -i && shutdown"
Code: Select all
megasync && dropbox start -i && shutdown
dropbox
command fails. &&
is the logical and operator (if the previous command is successful) and ||
is the logical or operator (if the previous command is unsuccessful), but ;
is just interpreted as a new line, so whether the previous command fails or not, the command after ;
will still execute.