LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-04-2009, 10:16 PM   #1
stg_in2009
LQ Newbie
 
Registered: Jan 2009
Posts: 6

Rep: Reputation: 0
Executing perl script from all users login


Hi All,

I have a perl script that needs to be run from all Login users say once a week. How to accomplish this? I dont want this to run at startup. From crontab it needs to be set in each users login. Is there a better way to do this?
I require my perl script to run at particular time on every saturday from all login. Any workaround to this requirement?
Server OS: RHEL 3
Kindly guide me.

Thanks

STG

Last edited by stg_in2009; 11-04-2009 at 10:17 PM.
 
Old 11-05-2009, 05:49 AM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by stg_in2009 View Post
Hi All,

I have a perl script that needs to be run from all Login users say once a week. How to accomplish this? I dont want this to run at startup. From crontab it needs to be set in each users login. Is there a better way to do this?
I require my perl script to run at particular time on every saturday from all login. Any workaround to this requirement?
Server OS: RHEL 3
Kindly guide me.

Thanks

STG

Depends what the script needs doing. Maybe it could be run from roots crontab and just cycle via each users home dir??
Or just add the cron to a file in normal cron format, and then
use a for loop to add to the crontab of each user.
something like

Code:
for user in `command to list valid users`
do
crontab -u $user file
done

Few ways to do this...dpends on what the actual script running from the cron does...
 
Old 11-05-2009, 09:25 PM   #3
stg_in2009
LQ Newbie
 
Registered: Jan 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Hi,
Thanks centosboy for your valuable reply.
Actually I have a perl script that checks for ClearCase views and deletes view-private files in it. This way it is possible to cleanup the ClearCase views. But the issue is, the ownership of all the view-private files in the ClearCase views are with the users who creates it. So, if I run this script from root it will not delete them.
I think to complish this, I have 2 options:
1. I have to have 2 scripts. First script changes the mode to 777 for all view-private files from the users login and then run another script (my present script) from root to actually delete them.

2. Else run this script from all login users without their knowledge. This will cleanup all the views in our setup. This is my goal.
The script is already ready but I am struck on how to implement it.

Any suggestion would be of great help.

Thanks again.
Regards

STG
 
Old 11-06-2009, 01:16 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,873

Rep: Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600
Given the 1st Perl script runs a root, it's got enough access/power to chmod the files, then delete them.
http://perldoc.perl.org/functions/chmod.html
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Instead of executing perl script,Mozilla Firefox opens it,why? mq15 Linux - Server 14 09-09-2010 08:04 AM
Executing Perl Script TalkingMarble Linux - Newbie 4 08-05-2008 08:33 AM
Executing unix commands from perl script running on Windows. harishkrishnan Programming 1 03-04-2008 11:48 PM
executing perl script through .forward file skverma_in Linux - Newbie 3 10-21-2004 07:24 AM
executing perl script through .forward file skverma_in Linux - General 0 10-18-2004 05:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration