FedoraThis forum is for the discussion of the Fedora Project.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
To start the program at night, use cron (check man crontab and man 5 crontab for information on how to do this, or ask here if you're having trouble).
To start your program at boottime, you can just add the command to an appropriate file in /etc/init.d (bootmisc.sh if you have one of those). This is the 'cheap and dirty' method. The 'right' way is to make a script similar to those in /etc/init.d (perhaps /etc/rc.d/init.d) that allows for stopping and starting your program, and putting appropriate links in /etc/rc?.d
The cron program is a daemon (that is a service) that runs in the background and starts programs running at certain times. The file which tells this program which programs to run and how often (daily, weekly, monthly, etc) and at what time is the /etc/crontab file. This file has its own man page which includes examples.
A program that is designed to run in the background, and answers requests is called a 'daemon' in Linux. Different ones will run depending upon which run-level you are using. For example, run level 3 provides networking, virtual consoles for multiple users. So the programs dealing with networking, and logging in need to be running. Another run level, 5, also provides the X Windows system. So additional programs need to be running.
There are other scripts that start during the boot process, and a lot depends on the type of program ( background daemon, x-windows program, KDE program ) that you need to run, and what its dependencies are.
Here is a web-site that explains the boot-up process:
In Fedora and RedHat the chkconfig(1) tool allows you to control which services are automatically started at each run level. Note that most, though not all services provide the configuration that chkconfig needs to be able to configure the service.
See 'man chkconfig' for more info.
'chkconfig --list' will print a table of the configuration of all services at all run levels.
my suggestion for the 'every night' program is to look at :
man cron
to explain the line you need to add to the bottom of :
/etc/crontab
it's really very simple, just be careful to get the time-values in the right positions.
also, for the 'every boot' program, if your distro has this file, just add the /dir/progname as the last line in :
/etc/init.d/rc.local
both are pure-text files.
TIP: when asking question, always specify the distro & version you are using, and maybe the file/lib(xfree/etc) versions that are involved. Mobo, Video, and other hardware info should be added if they might matter; best is to always include a brief description of all this -- make a standard textfile & keep them there & just always include it at the bottom of every 'helpme!', or make them part of your sig (like my "Words of Wisdom" below). The former takes a moment more work, but works every time, everywhere.
LOL,
robert
Last edited by Robert G. Hays; 10-01-2004 at 01:21 PM.
I use FC 2 and Rh9. My bash script file run well by using command line. But it doesn't work if i put it into /etc/crontab. So I create a test file with 755 permission in /root directory as following:
Your first example was probably the one that got results, because you specified the full path to the script. Your second example would run every day, but it would run /usr/bin/test instead of your script, and /usr/bin/test with no arguments does nothing
Try adding this to your script before the gftp command line:
DISPLAY=:0.0
and try again - I think gftp is telling you it won't run in text mode, so you need to tell it which X server to talk to.
The Path : if your script file has uniq name so you can set the path here and you can type the name of your script file in runparts.
The Home: If you script file call lib so you much put this lib in the same dir and set Home to this dir.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.