[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opensuse
Subject:    Re: [opensuse] running a program before shutdown
From:       ianseeks <ianseeks () yahoo ! co ! uk>
Date:       2014-04-28 16:01:58
Message-ID: 2896524.h3QqYIpvnX () lianli ! site
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic