[opensuse] running a program before shutdown
Hi everyone! I do have a small problem: I want to run unison before i log out of kde, so that my files are synchronized automatically. I created a .desktop file and placed it in /.kde4/shutdown/. The .desktop file is specified by the command: unison myprofile -batch I tried it, but it seems, that this doesn´t work, because nothing was synchronized after login in again. Although in the systemsettings in the category autostart, my .desktop is listed and set to logout. Any suggestions. Best Benjamin! ps.: I already tried it with a shell-scrpit, which i also placed in the shutdown folder, but this also didn´t work…
On 22/04/14 05:35, Benjamin wrote:
Hi everyone! I do have a small problem: I want to run unison before i log out of kde, so that my files are synchronized automatically. I created a .desktop file and placed it in /.kde4/shutdown/. The .desktop file is specified by the command: unison myprofile -batch I tried it, but it seems, that this doesn´t work, because nothing was synchronized after login in again. Although in the systemsettings in the category autostart, my .desktop is listed and set to logout. Any suggestions.
Best Benjamin!
ps.: I already tried it with a shell-scrpit, which i also placed in the shutdown folder, but this also didn´t work…
I do something similar, but I used bash scripts instead of .desktop files to run rsync on log out. The key was that I needed to have two scripts: One that does the work (runs rsync) the other was a wrapper that starts up konsole with my first script. This is the script I have in my ~/.kde4/shutdown/myrsync_wrapper.sh. konsole --nofork --hide-menubar --hide-tabbar --geometry "1680x1050+0+0" -e $HOME/myrsync.sh exit 0 When I log out or shutdown, KDE runs the myrsync_wrapper.sh script. A konsole is then started with dimensions 1680x1050. This forces the window to fill my whole screen. If I am logging out and I do not want to run the script, say after an update to KDE, I simply press CTRL+C in konsole and the script exits and KDE logs out as per usual. Hope this helps, Alvin -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 22/04/14 05:35, Benjamin wrote:
Hi everyone! I do have a small problem: I want to run unison before i log out of kde, so that my files are synchronized automatically. I created a .desktop file and placed it in /.kde4/shutdown/. The .desktop file is specified by the command: unison myprofile -batch I tried it, but it seems, that this doesn´t work, because nothing was synchronized after login in again. Although in the systemsettings in the category autostart, my .desktop is listed and set to logout. Any suggestions.
Best Benjamin!
ps.: I already tried it with a shell-scrpit, which i also placed in the shutdown folder, but this also didn´t work…
I do something similar, but I used bash scripts instead of .desktop files to run rsync on log out.
The key was that I needed to have two scripts: One that does the work (runs rsync) the other was a wrapper that starts up konsole with my first script.
This is the script I have in my ~/.kde4/shutdown/myrsync_wrapper.sh.
konsole --nofork --hide-menubar --hide-tabbar --geometry "1680x1050+0+0" -e $HOME/myrsync.sh
exit 0
When I log out or shutdown, KDE runs the myrsync_wrapper.sh script. A konsole is then started with dimensions 1680x1050. This forces the window to fill my whole screen.
If I am logging out and I do not want to run the script, say after an update to KDE, I simply press CTRL+C in konsole and the script exits and KDE logs out as per usual.
Hope this helps,
Alvin Hi Alvin! Thanks for your suggestion! I tried it with the wrapper script like you wrote, but still nothing is happening during the log out … It seems,
Am 23.04.2014 14:27, schrieb Alvin Beach: that kde is not even trying to run a script i put in /.kde4/shutdown… Thanks!
El 28/04/14 11:10, Benjamin escribió:
Alvin Hi Alvin! Thanks for your suggestion! I tried it with the wrapper script like you wrote, but still nothing is happening during the log out … It seems, that kde is not even trying to run a script i put in /.kde4/shutdown…
Well.. see if it is actually running it. as the first line echo "Attempting to run my script" | systemd-cat then look at the journal if the message is written or not journalctl --since=today -- Cristian "I don't know the key to success, but the key to failure is trying to please everybody." -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Monday 28 Apr 2014 17:10:28 Benjamin wrote:
Am 23.04.2014 14:27, schrieb Alvin Beach:
On 22/04/14 05:35, Benjamin wrote:
Hi everyone! I do have a small problem: I want to run unison before i log out of kde, so that my files are synchronized automatically. I created a .desktop file and placed it in /.kde4/shutdown/. The .desktop file is specified by the command: unison myprofile -batch I tried it, but it seems, that this doesn´t work, because nothing was synchronized after login in again. Although in the systemsettings in the category autostart, my .desktop is listed and set to logout. Any suggestions.
Best Benjamin!
ps.: I already tried it with a shell-scrpit, which i also placed in the shutdown folder, but this also didn´t work…> I do something similar, but I used bash scripts instead of .desktop files to run rsync on log out.
The key was that I needed to have two scripts: One that does the work (runs rsync) the other was a wrapper that starts up konsole with my first script.
This is the script I have in my ~/.kde4/shutdown/myrsync_wrapper.sh.
konsole --nofork --hide-menubar --hide-tabbar --geometry "1680x1050+0+0" -e $HOME/myrsync.sh
exit 0
When I log out or shutdown, KDE runs the myrsync_wrapper.sh script. A konsole is then started with dimensions 1680x1050. This forces the window to fill my whole screen.
If I am logging out and I do not want to run the script, say after an update to KDE, I simply press CTRL+C in konsole and the script exits and KDE logs out as per usual.
Hope this helps,
Alvin
Hi Alvin! Thanks for your suggestion! I tried it with the wrapper script like you wrote, but still nothing is happening during the log out … It seems, that kde is not even trying to run a script i put in /.kde4/shutdown…
Thanks! Benjamin
I've got a bash scri[t file in .kde4/shutdown/ folder and it works fine on logout. Have you set the execute permissions etc on the script file? My script contains the following:- date > ~/logout.result echo "Starting backup" >> ~/logout.result echo "rsync -av /home/userone/Mail" >> ~/logout.result rsync -av /home/userone/Mail /MasterBackup/userone echo "rsync -av /home/userone/.kde4" >> ~/logout.result rsync -av /home/userone/.kde4 /MasterBackup/userone echo "rsync -av /home/userone/.local" >> ~/logout.result rsync -av /home/userone/.local /MasterBackup/userone echo "rsync -av /home/userone/Documents" >> ~/logout.result rsync -av /home/userone/Documents /MasterBackup/userone echo "rsync -av /home/userone/backup.sh" >> ~/logout.result rsync -av /home/userone/backup.sh /MasterBackup/userone echo "Backup done" >> ~/logout.result date >> ~/logout.result exit 0 I can then check the logout.result file to see if it worked . regards Ian -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Am 28.04.2014 17:34, schrieb Cristian Rodríguez:
El 28/04/14 11:10, Benjamin escribió:
Alvin Hi Alvin! Thanks for your suggestion! I tried it with the wrapper script like you wrote, but still nothing is happening during the log out … It seems, that kde is not even trying to run a script i put in /.kde4/shutdown…
Well.. see if it is actually running it.
as the first line
echo "Attempting to run my script" | systemd-cat
then look at the journal if the message is written or not
journalctl --since=today
Okay i put the "Sync.sh" in the shutwdown folder. It has the following content: # !/bin/bash echo "unison DeskSync -batch" | systemd-cat unison DeskSync -batch exit 0 Is it right? When i run journalctl --since=today no journal files are found… I did sudo chmod -x Sync.sh before I tried the script… Best, Benjamin.
El 28/04/14 12:29, Benjamin escribió:
Is it right? When i run journalctl --since=today no journal files are found…
Did you ran that command as root ? -- Cristian "I don't know the key to success, but the key to failure is trying to please everybody." -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
El 28/04/14 19:04, Benjamin escribió:
No as user…Should i run it as root?
Yes. -- Cristian "I don't know the key to success, but the key to failure is trying to please everybody." -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Am 29.04.2014 01:37, schrieb Cristian Rodríguez:
El 28/04/14 19:04, Benjamin escribió:
No as user…Should i run it as root?
Yes.
Thanks for help i think i did something wrong with the permissions with regard to the script … I now did a chmod 777 Sync.sh and now the script works fine! Just beside: what is the difference between chmod 777 and chmod -x ? And must i also run chmod as sudo if i make an script for me as a normal user or does it suffice to run chmod as user? Best Benjamin.
On 04/29/2014 02:53 PM, Benjamin wrote:
I now did a chmod 777 Sync.sh and now the script works fine!
It's very rarely needed to use 'chmod 777' - especially if you are not very familiar with these octal permission modes, then please forget using 777: it makes the file readable, writable and executable by the owner, the group and everyone else; you'll see this as "rwxrwxrwx" in an "ls -l" listing. So in your case, I'd probably at least do a "chmod go-w" on that file for security reasons.
Just beside: what is the difference between chmod 777 and chmod -x ?
Did you mean "chmod +x" instead? This would make the file executable.
And must i also run chmod as sudo if i make an script for me as a normal user or does it suffice to run chmod as user?
root can change the permissions on any file, any normal user can only change the permissions if she is the owner. Further docs: http://www.gnu.org/software/coreutils/manual/html_node/chmod-invocation.html http://www.gnu.org/software/coreutils/manual/html_node/File-permissions.html Have a nice day, Berny -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Okay Thanks – good info ;) So for my use chmod 755 Script.sh should be fine… Nice day! Am 29.04.2014 15:14, schrieb Bernhard Voelker:
On 04/29/2014 02:53 PM, Benjamin wrote:
I now did a chmod 777 Sync.sh and now the script works fine!
It's very rarely needed to use 'chmod 777' - especially if you are not very familiar with these octal permission modes, then please forget using 777: it makes the file readable, writable and executable by the owner, the group and everyone else; you'll see this as "rwxrwxrwx" in an "ls -l" listing.
So in your case, I'd probably at least do a "chmod go-w" on that file for security reasons.
Just beside: what is the difference between chmod 777 and chmod -x ?
Did you mean "chmod +x" instead? This would make the file executable.
And must i also run chmod as sudo if i make an script for me as a normal user or does it suffice to run chmod as user?
root can change the permissions on any file, any normal user can only change the permissions if she is the owner.
Further docs: http://www.gnu.org/software/coreutils/manual/html_node/chmod-invocation.html
http://www.gnu.org/software/coreutils/manual/html_node/File-permissions.html
Have a nice day, Berny
Benjamin wrote:
what is the difference between chmod 777 and chmod -x ? And must i also run chmod as sudo if i make an script for me as a normal user or does it suffice to run chmod as user?
Chmod 777 sets all bits, so everyone will have read, write and execute privileges. Chmod -x only enables the execute bit. You don't need to use sudo for your own files. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
James Knott wrote:
what is the difference between chmod 777 and chmod -x ? And must i also run chmod as sudo if i make an script for me as a normal user or does it suffice to run chmod as user? Chmod 777 sets all bits, so everyone will have read, write and execute
Benjamin wrote: privileges. Chmod -x only enables the execute bit. You don't need to use sudo for your own files.
Sorry, -x remove execute. Use +x to add it. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
El 29/04/14 10:01, James Knott escribió:
Benjamin wrote:
what is the difference between chmod 777 and chmod -x ? And must i also run chmod as sudo if i make an script for me as a normal user or does it suffice to run chmod as user?
Chmod 777 sets all bits, so everyone will have read, write and execute privileges. Chmod -x only enables the execute bit. You don't need to use sudo for your own files.
Yes and KDE should probably refuse to run world-writable scripts there. -- Cristian "I don't know the key to success, but the key to failure is trying to please everybody." -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 El 2014-04-29 a las 15:44 +0200, Benjamin escribió:
Okay Thanks – good info ;) So for my use chmod 755 Script.sh should be fine…
700 wold be fine. Why do you want any body else to be able to read and run your file? - -- Cheers Carlos E. R. (from 13.1 x86_64 "Bottle" (Minas Tirith)) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iF4EAREIAAYFAlNgSX4ACgkQja8UbcUWM1ze1QD/alyLWbpSKTczv4HRhyVmTcYb eUNmDXan0z6wXB+Oj8EA/jg/t3bT7hAuvmmcnyKnz1B1XH8nodOWEX6gEGf7RwYd =V9qf -----END PGP SIGNATURE-----
Hallo Benjamin, I made a systemd.service for a backup script, but it did run only after I made at first a cd /home to prevent the unmounting of the home folders. Am Dienstag, 22. April 2014 10:35 schrieb Benjamin:
Hi everyone! I do have a small problem: I want to run unison before i log out of kde, so that my files are synchronized automatically. I created a .desktop file and placed it in /.kde4/shutdown/. The .desktop file is specified by the command: unison myprofile -batch I tried it, but it seems, that this doesn´t work, because nothing was synchronized after login in again. Although in the systemsettings in the category autostart, my .desktop is listed and set to logout. Any suggestions.
Best Benjamin!
ps.: I already tried it with a shell-scrpit, which i also placed in the shutdown folder, but this also didn´t work…
-- Herzliche Grüße! Rolf Muth Meine Adressen dürfen nicht für Werbung verwendet werden! S/MIME Zertifikat 0x25F0E92D9AE21AE6
participants (8)
-
Alvin Beach
-
Benjamin
-
Bernhard Voelker
-
Carlos E. R.
-
Cristian Rodríguez
-
ianseeks
-
James Knott
-
Rolf Muth