LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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-30-2010, 01:58 PM   #1
Phaethar
Member
 
Registered: Oct 2003
Location: MN
Distribution: CentOS, Fedora
Posts: 182

Rep: Reputation: 30
Question Starting a job at startup without logging in


Hey all,

Kind of an interesting project here. I'm trying to think of the best way to have a job start up on it's own when a system (running CentOS 5) boots up. The job is a simple python script. However, there are some interesting conditions that need to be met:

- As stated, script needs to start and run in the background when the system boots up, but without anyone logging in.
- This script needs to be readable only by root, which means it will need to be run as root
- Only 1 person will have root access, meaning nobody else will have access to see this script or it's status.

The entire point is to have this thing running all the time, even if the system reboots, but to make it so nobody can see the script or view it's source, unless they have root access, which only 1 person will have.

I can think of plenty of ways to have things start up automatically when a system comes up, but they all involve having the user log in as part of it. How can I have a listening python script start up, at boot up, on it's own, without root actually logging in?
 
Old 11-30-2010, 02:06 PM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Use the @reboot facility in root's crontab, or create your own init script with symlinks in the right runlevels. http://wiki.linuxquestions.org/wiki/...tartup_scripts
 
Old 11-30-2010, 02:42 PM   #3
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
My suggestions are:

1) Forget about the running the script as root. Create a non-root user specifically for this task and run the script as that user. The root user will still be able to "read" it, and limiting it to one locked down user + root isn't really any different.

2) Stating only one user will have access to root is not true if the script is run as root. One user plus anybody else who can circumvent this script would have access to root. Only one person would have access to root if it is run as a different user even if someone circumvents it.

3) Without knowing much more about the functionality of the script, I would say run it as a daemon rather than w/ cron.

HTH

Forrest
 
  


Reply



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
How to schedule a job after one minute of startup? rockor Linux - General 9 11-14-2010 12:45 AM
BIND not starting or logging wacko_cracko Linux - Software 2 08-07-2008 07:27 AM
Printer Job logging (PHP/MySQL) technopasta Programming 1 06-07-2006 04:13 AM
Turn off logging for specific cron job guyk Linux - Software 10 10-24-2004 11:23 PM
Starting a new Linux Job (need advice please) hubergeek Linux - General 10 09-18-2002 01:03 PM

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

All times are GMT -5. The time now is 12:01 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