FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 05-27-2012, 10:18 PM
Frank McCormick
 
Default backing up

On 27/05/12 05:18 PM, Ralf Mardorf wrote:

On Sun, 2012-05-27 at 16:51 -0400, Frank McCormick wrote:

On 27/05/12 04:42 PM, Ralf Mardorf wrote:



/etc/gdm3/PostSession/Default

#!/bin/sh
sh ~/a_script
exit 0

/home/user_dir/a_script

#!/bin/sh
cp -R ~/.thunderbird ~/thunderbird.backup
exit 0

How to check if the file exists is described in the Internet.


Before I go off-line a last hint ;p.

spinymouse@precise:~$ [ -f /etc/fstubby ]&& echo yes
spinymouse@precise:~$ echo $?
1
spinymouse@precise:~$ [ -f /etc/fstab ]&& echo yes
yes
spinymouse@precise:~$ echo $?
0
spinymouse@precise:~$ test -f /etc/fstab&& echo yes
yes
spinymouse@precise:~$ echo $?
0
spinymouse@precise:~$ man test
spinymouse@precise:~$ [ ! -f /etc/fstubby ]&& echo yes
yes

Hth,
Ralf





All filed away....you're turning me into a CLI fiend...next thing
I'll be using MUTT Well.......not for a while....





Take care that "cp -R" is ok, perhaps you should use "cp -pr".


Good idea....and I also might add -u..i.e. cp -pru

Thanks
--
Cheers
Frank


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4FC2A82D.3030802@videotron.ca">http://lists.debian.org/4FC2A82D.3030802@videotron.ca
 
Old 05-28-2012, 08:31 AM
Chris Davies
 
Default backing up

Frank McCormick <debianlist@videotron.ca> wrote:
> Just for fun I created a new user (my wife)..and ran a session under
> "her" account...she could not write to my directory so nothing happened.
> This whole thread has convinced me I need to learn more about bash and
> scripting

It's not difficult[*] to check what userid the PostSession script
runs as, and it is definitely root. So your script will backup your
thunderbird directory (as root) regardless of who logs out.

For a generic solution you could try creating this as your
PostSession/Default:

#!/bin/sh
#
# PostSession
#
GDM_USER_FILE="$HOME/.gdm_postsession"

if test -x "$GDM_USER_FILE"
then
cd "$HOME"
su "$LOGNAME" "$GDM_USER_FILE"
fi
exit 0

And then you can put your custom commands in your own .gdm_postsession
file, in your home directory. (Don't forget to make it executable).

Chris
[*] Not difficult for a someone who can write scripts, that is


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: iopb99xuje.ln2@news.roaima.co.uk">http://lists.debian.org/iopb99xuje.ln2@news.roaima.co.uk
 
Old 05-28-2012, 03:26 PM
Frank McCormick
 
Default backing up

On 28/05/12 04:31 AM, Chris Davies wrote:

Frank McCormick<debianlist@videotron.ca> wrote:

Just for fun I created a new user (my wife)..and ran a session under
"her" account...she could not write to my directory so nothing happened.
This whole thread has convinced me I need to learn more about bash and
scripting


It's not difficult[*] to check what userid the PostSession script
runs as, and it is definitely root. So your script will backup your
thunderbird directory (as root) regardless of who logs out.

For a generic solution you could try creating this as your
PostSession/Default:

#!/bin/sh
#
# PostSession
#
GDM_USER_FILE="$HOME/.gdm_postsession"

if test -x "$GDM_USER_FILE"
then
cd "$HOME"
su "$LOGNAME" "$GDM_USER_FILE"
fi
exit 0

And then you can put your custom commands in your own .gdm_postsession
file, in your home directory. (Don't forget to make it executable).



What I ended up doing was to add the -p parameter to cp to ensure
attributes were maintained. Also added -u to only update changed files





--
Cheers
Frank


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4FC3990F.1090203@videotron.ca">http://lists.debian.org/4FC3990F.1090203@videotron.ca
 
Old 05-28-2012, 07:48 PM
Chris Davies
 
Default backing up

Frank McCormick <debianlist@videotron.ca> wrote:
> What I ended up doing was to add the -p parameter to cp to ensure
> attributes were maintained. Also added -u to only update changed files

Based on the previous postings in the thread this will run whenever anyone
logs out, not just you. As long as you're aware of risks associated with
this solution that's fine. But personally I prefer not to take avoidable
risks with backups - I never know when I'm going to need one.

Chris


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 3e1d99xsja.ln2@news.roaima.co.uk">http://lists.debian.org/3e1d99xsja.ln2@news.roaima.co.uk
 

Thread Tools




All times are GMT. The time now is 04:55 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org