The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > OS X (Apple)
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


OS X (Apple) OS X is a line of Unix-based graphical operating systems developed, marketed, and sold by Apple.


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script for automatic deletion of trash file of mail server crown2100bd SUN Solaris 1 09-20-2007 05:01 AM
clean up script mpang_ Shell Programming and Scripting 1 07-17-2006 08:14 PM
ksh in rc3.d startup script JayNick Shell Programming and Scripting 1 05-19-2006 08:28 AM
writing script to clean up a directory ajaya Shell Programming and Scripting 0 04-26-2006 07:18 AM
Startup script DSL c19h28O2 Shell Programming and Scripting 0 04-11-2006 01:54 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-11-2006
Registered User
 

Join Date: Aug 2006
Posts: 120
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Startup script to clean out trash can

I need to know how I would be able to clean out the trash can of a single "dumb" user every time the MAC is turned on.

Back ground.
OS 10.3x
G3 Mac
Two users configured...
1) Root or Admin (superuser)
2) student (Simple no access to anything but shared folder for files etc.)

The problem is student's keep deleteing items from the itunes area and the trash can fills up and gives system warnings about the trash getting to full ie /tmp 100%....

It would be great if I could create a startup script the deletes the trash for the user and modify the startup some how for this....

I know a little unix but never played with MAC's before

Thanks in advance
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-11-2006
Hitori's Avatar
Registered User
 

Join Date: Jun 2006
Posts: 355
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
May be cron is a better solution?
Reply With Quote
  #3 (permalink)  
Old 10-12-2006
Registered User
 

Join Date: Aug 2006
Posts: 120
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Thanks...
I will look around the OS and....
Reply With Quote
  #4 (permalink)  
Old 10-13-2006
Registered User
 

Join Date: Sep 2006
Posts: 11
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
A gui solution would be:

Compost
automatic trash management
http://www.mac-compost.com/


Cheers,
verno
Reply With Quote
  #5 (permalink)  
Old 10-19-2006
Registered User
 

Join Date: Sep 2002
Location: San Fran
Posts: 105
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
A login or logout hook could do this pretty easily.
Check out bombich.com for information about login/out hooks.

Basically the login hook mechanism puts the username into $1.
In pseudo code, the code to add to the login hook would go:
If "$1" equals studentusername
then rm -r /Users/studentusername/.Trash/*
End If

The system runs login hooks with root privs, so there should not be any access problem for the directory.
Admin privs (sudo) are required to add or remove login/out hooks. The script should be rwx for root only and stored in a directory with, at best, only root access.

A login or logout hook is really just a preference setting that points to a script to run (if I recall correctly). Well, that and some code some where responsible for passing the username to the script.

It should be said that the root account does not have to be enabled at all to create and use this hook functionality.
It can be a pretty powerful tool, and as with all powerful tools, test, test, test, then implement.
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 07:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102