-   Fedora (
-   -   auto start application (

acrors 09-30-2004 10:39 PM

auto start application

I have two programs, one i want to start automatically at night, another i want to start at boot time (both of them are my programs).

Pls. show me how to do ....

Thank for your help

CroMagnon 09-30-2004 11:33 PM

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 ( 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

acrors 10-01-2004 03:55 AM

More detail pls
I'm new in linux .... pls tell me more detail ....

jschiwal 10-01-2004 05:44 AM

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:

hmc 10-01-2004 08:05 AM


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.


Robert G. Hays 10-01-2004 01:07 PM

Your Sig: True! :)


Robert G. Hays 10-01-2004 01:15 PM


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 :
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 :

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.


acrors 10-02-2004 08:58 AM

problem with cron
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:

gftp ftp://anonymous:user@site@ftp.ncsa.u...DF/HDF_Current

and i modified /etc/crontab as following:

PATH=/sbin:/bin:/usr/sbin:/usr/bin: #or /sbin:/bin:/usr/sbin:/usr/bin:/root

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
48 20 2 10 * root /root/test # or 48 20 * * * root test

But i get error msg as "Sorry, gftp-text has been disabled." or nothing happen.

What did i do wrong here ?

Pls show me ...

CroMagnon 10-02-2004 12:20 PM

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:


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.

acrors 10-03-2004 10:47 PM

I found the solution
Thank you, my friends

This is my solution :

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.

atanwar 10-11-2004 11:22 AM

USE CRON to do so.... add entry in crontab file.

All times are GMT -5. The time now is 01:08 PM.