LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 09-30-2004, 11:39 PM   #1
acrors
Member
 
Registered: Aug 2004
Posts: 72

Rep: Reputation: 15
auto start application


Hi

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
 
Old 10-01-2004, 12:33 AM   #2
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
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
 
Old 10-01-2004, 04:55 AM   #3
acrors
Member
 
Registered: Aug 2004
Posts: 72

Original Poster
Rep: Reputation: 15
More detail pls

I'm new in linux .... pls tell me more detail ....
 
Old 10-01-2004, 06:44 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
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:

http://www.comptechdoc.org/os/linux/startupman/
 
Old 10-01-2004, 09:05 AM   #5
hmc
LQ Newbie
 
Registered: Aug 2004
Location: Denmark
Distribution: Centos, Fedora
Posts: 23

Rep: Reputation: 15
Hi,

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.

/Hugo

Last edited by hmc; 10-01-2004 at 09:07 AM.
 
Old 10-01-2004, 02:07 PM   #6
Robert G. Hays
Member
 
Registered: Jan 2003
Location: Atlanta, Ga., USA
Distribution: Gentoo, Mandrake, ~others
Posts: 157

Rep: Reputation: 30
CroMag,
Your Sig: True!

robert.
 
Old 10-01-2004, 02:15 PM   #7
Robert G. Hays
Member
 
Registered: Jan 2003
Location: Atlanta, Ga., USA
Distribution: Gentoo, Mandrake, ~others
Posts: 157

Rep: Reputation: 30
acrors,

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 02:21 PM.
 
Old 10-02-2004, 09:58 AM   #8
acrors
Member
 
Registered: Aug 2004
Posts: 72

Original Poster
Rep: Reputation: 15
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:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin: #or /sbin:/bin:/usr/sbin:/usr/bin:/root
MAILTO=root
HOME=/

# 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 ...
 
Old 10-02-2004, 01:20 PM   #9
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
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.
 
Old 10-03-2004, 11:47 PM   #10
acrors
Member
 
Registered: Aug 2004
Posts: 72

Original Poster
Rep: Reputation: 15
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.
 
Old 10-11-2004, 12:22 PM   #11
atanwar
LQ Newbie
 
Registered: Nov 2003
Location: :PUNE, INDIA 411008
Distribution: redhat-6,7,9, fedoracore-1,2,3, AIX-5.1,5.2 , Tru64 5.1A, SUSE 10.0,ES9
Posts: 14

Rep: Reputation: 0
USE CRON to do so.... add entry in crontab file.
 
  


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
How do I auto start modules that aren't auto loaded on boot? darkbluedrew Debian 2 09-18-2005 10:10 AM
eth0 Auto Connect, How to auto start on logon cornish Linux - Networking 2 05-09-2005 01:02 PM
Adding an application to auto-start on boot-time dushkinup Linux - Newbie 4 03-07-2004 08:55 PM
auto application(timed by day) running krome Mandriva 1 01-31-2004 05:21 PM
Auto starting an application bbereg Linux - Newbie 7 11-21-2002 05:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 01:41 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration