![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help with linux shell script | emachala | Shell Programming and Scripting | 1 | 01-26-2009 01:13 AM |
| GUI shell script for Linux | mr_aliagha | Shell Programming and Scripting | 0 | 12-05-2008 10:28 AM |
| how to encrypt my shell script program in linux | akm9999 | Shell Programming and Scripting | 3 | 09-09-2008 05:30 AM |
| Linux Shell Question: how to print the shell script name ? | meili100 | UNIX for Dummies Questions & Answers | 3 | 07-01-2008 02:55 PM |
| porting shell script from Linux to AIX. | joy_1 | Shell Programming and Scripting | 6 | 12-27-2007 02:57 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Linux Shell Script
I'm interested in writing a (hopefully) simple Linux Shell Script.
Upon shutdown of the system (or upon reboot), I would like the script to automatically reset any changes made during that session. This includes files saved to the hard disk as well as any configuration changes. I would also like the script to be run only with guest accounts, the administrative account would not have the script run. Can anyone help me out? I'm not even sure where to start. |
|
||||
|
As long as guests are unprivileged users that cannot change things outside of their home directory (/home/guest ?) this is relatively simple.
You can make a copy/backup of the freshly created guest user's home directory: Code:
cp -rp /home/guest /home/guest_bak If you made a backup as "/home/guest_bak" (directory not file). Then you can make a script like: Code:
#!/bin/sh rm -f /home/guest cp -rp /home/guest_bak /home/guest Code:
chmod +x /usr/local/bin/clean_guest.sh Last edited by ddreggors; 02-10-2009 at 01:53 AM.. |
|
|||||
|
An example for an init script can be found at /etc/init.d/skeleton in most distributions.
As for the snapshot, create it first from the shell and modify /etc/fstab to boot from the snapshot instead of the usual partition. Then, in the init script, make sure that all required modules are loaded, remove the old snapshot using lvremove, and create it new, using the same command as on the command line. A good intro to LVM can be found at The Linux Documentation Project |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|