The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Operating Systems > OS X (Apple)
.
google unix.com



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

More UNIX and Linux Forum Topics 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 09:01 AM
clean up script mpang_ Shell Programming and Scripting 1 07-18-2006 12:14 AM
ksh in rc3.d startup script JayNick Shell Programming and Scripting 1 05-19-2006 12:28 PM
writing script to clean up a directory ajaya Shell Programming and Scripting 0 04-26-2006 11:18 AM
Startup script DSL c19h28O2 Shell Programming and Scripting 0 04-11-2006 05:54 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-12-2006
Andrek Andrek is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 122
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
  #2 (permalink)  
Old 10-12-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2006
Posts: 360
May be cron is a better solution?
  #3 (permalink)  
Old 10-12-2006
Andrek Andrek is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 122
Thanks...
I will look around the OS and....
  #4 (permalink)  
Old 10-13-2006
verno verno is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 14
A gui solution would be:

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


Cheers,
verno
  #5 (permalink)  
Old 10-19-2006
[MA]Flying_Meat [MA]Flying_Meat is offline
Registered User
  
 

Join Date: Sep 2002
Location: San Fran
Posts: 131
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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

BB 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 -4. The time now is 06:33 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0