![]() |
|
|
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 |
| logout script common for both Mac and Linux? | harsha10 | UNIX for Advanced & Expert Users | 0 | 06-27-2008 03:17 PM |
| run a script at logout | harsha10 | UNIX for Dummies Questions & Answers | 0 | 06-22-2008 09:01 AM |
| set schedule to run a script at background while logout | happyv | Shell Programming and Scripting | 1 | 01-24-2007 01:17 AM |
| Login and logout script | jhansrod | UNIX for Dummies Questions & Answers | 1 | 06-06-2005 07:54 AM |
| logout/shutdown script | ropers | UNIX for Dummies Questions & Answers | 1 | 08-02-2002 03:05 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Logout script - delete a file
Good evening you scripting guru's!
I have the following script to delete a file on logout of a Mac : Code:
find . –name com.apple.sidebarlists.plist –exec rm -f {} \;
Is there a way to just run the command and targeting the current directory it is contained in? What would the syntax be to search the directory Library/Preferences? Thanks, AG Last edited by pludi; 4 Weeks Ago at 12:47 PM.. Reason: code tags, please... |
|
||||
|
Quote:
![]() |
|
||||
|
delete file
Deleting is the easy part....
History of this: We run an AD environment with MACs running 10.3.9 and 10.4.11 The com.apple.sidebarlists.plist sets up differently when logging onto either OS. So, when you go back and forth between OS's - A volume error occurs. Apple has confirmed this issue. Their suggestion was to write a script to delete the file at logout. The script above actually works, but thier is a lag time when logging out. I tried the nohup command, but so far it hasn't worked for a user connected to the server. Using the (find . -name) searches through all files on the drive before hitting the correct file to delete. (SLOW) I have tried find ./Library in the sh but it only works in terminal and will not work when logging out. Is there a variable in which I can put into the script that will go directly to the file and delete it? Thanks for any suggestions. AG |
|
||||
|
You need to give absolute path in the find command, like
Code:
find /var/lib -name 'NAME' Also, there is a useful option -xdev in "find", which will be of great use to you if you have multiple filesystems and wasting time in other places. |
|
||||
|
Is the file stored in different locations between the osx versions?
sw_vers -productVersion will give you the major minor and patch level. OSXVER=`sw_vers -productVersion | awk -F. '{print $1 "." $2}'` I use the above variable to run different script stuff against different osx versions. Since they all seem to be different and require specific scripts for each one ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|