run this script as a daemon process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting run this script as a daemon process
# 1  
Old 11-08-2011
run this script as a daemon process

Hi,

HI ,
I have a simple script that moves files from one folder to another folder, I have already done the open-ssh server settings and the script is working fine and is able to transfer the files from one folder to another but right now I myself execute this script by using my creditianls to connect through remote server through putty ...the script is below...
Code:
#!/bin/bash
 . /home/p2000/sxs137/scripts/archieve2.config

sftp $userid@$Remoteurl <<EOF
lcd $SrcFolders
cd $DestFolder
mput $SourcefilePattern
exit
EOF


Now I want this script to be run automatically after every 1 hour , that is it should transfer the files from source folder to destination folder after every 1 hour please guide me how to run t this script as daemon process ..!!Smilie
# 2  
Old 11-08-2011
set in cronjob, man crontab first
Code:
  crontab Entry Format
     A crontab file consists of lines of  six  fields  each.  The
     fields  are  separated by spaces or tabs. The first five are
     integer patterns that specify the following:

       minute (0-59),
       hour (0-23),
       day of the month (1-31),
       month of the year (1-12),
       day of the week (0-6 with 0=Sunday).

For example, run the script every hour
Code:
0 * * * * your_script

This User Gave Thanks to rdcwayx For This Post:
# 3  
Old 11-08-2011
Quote:
Originally Posted by rdcwayx
set in cronjob, man crontab first
Code:
  crontab Entry Format
     A crontab file consists of lines of  six  fields  each.  The
     fields  are  separated by spaces or tabs. The first five are
     integer patterns that specify the following:

       minute (0-59),
       hour (0-23),
       day of the month (1-31),
       month of the year (1-12),
       day of the week (0-6 with 0=Sunday).

For example, run the script every hour
Code:
0 * * * * your_script

Hi rdcwayx,

Thanx a lot, amazing ...cheers up , one thing that I want to clear is that for this corntab entry i have to execute this command in putty with the parameters guided by you , as i was planning to configure it , means shall i write this statement of crontab in a seprate file or in the main script itself..so that when I execute my main script file itself the process get spawned and from there onwards it should start as a daemon process..!!


will Nohup command is close to thing that I want to achieve...? I think work for this case please guide me so that Nohup should continue to run the this daemon process even after I log out..!!

Last edited by nks342; 11-08-2011 at 02:19 AM..
# 4  
Old 11-08-2011
you can enter the cron jobs in the crontab file by using -e option

PHP Code:
crontab -
This will open the cron job file for editing . you can add your enrty and save it and exit.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Daemon process

I wish to make a process run in the background, but only one instance of it, and not many, so when the program is loaded, it has to check whether another instance of the same program is running and if so to exit. How do I do this ? (4 Replies)
Discussion started by: sundaresh
4 Replies

2. Red Hat

How to run a process through shell script.?

hey , i have to write a script to run a process through shell script and if the process runs successfully then return success. i used nohup to start the process but nothing occured . #!/bin/sh nohup ./cvt -f MediationSources.xml & can anyone pls help me Thanks (3 Replies)
Discussion started by: ramsavi
3 Replies

3. Shell Programming and Scripting

How to make a bash or shell script run as daemon?

Say i have a simple example: root@server # cat /root/scripts/test.sh while sleep 5 do echo "how are u mate" >> /root/scripts/test.log done root@server # Instead of using rc.local to start or another script to check status, I would like make it as daemon, where i can do the following: ... (2 Replies)
Discussion started by: timmywong
2 Replies

4. Shell Programming and Scripting

script to run as a daemon

Hi, I have one query that is suppose if I have a script that pick up some files from source folder and put it into destination folder , and I want this script to run after every 1 hour, to make it configurable as per that I have options like crontab and nohup but when I test this script I have to... (2 Replies)
Discussion started by: nks342
2 Replies

5. Shell Programming and Scripting

Creating a daemon to run in background

I am trying to create a service to always run and monitor a script that has a tendency to hang, we could not find what is causing it to hang so are in the process of completely reprogramming just about everything, however, that will take upto 6 months. So I need to create this to monitor the... (5 Replies)
Discussion started by: ukndoit
5 Replies

6. Shell Programming and Scripting

run script with booting process

hi all, I write a shell script which search file in particular folder and copy another folder.after that i compare two folder if file did not match then copy file from one to another folder.Both New and New1 folder contains file with different name. The code of my script is here #!/bin/bash ... (4 Replies)
Discussion started by: shubhig15
4 Replies

7. Shell Programming and Scripting

script to monitor the process system when a process from user takes longer than 15 min run.

get email notification from from system when a process from XXXX user takes longer than 15 min run.Let me know the time estimation for the same. hi ,any one please tell me , how to write a script to get email notification from system when a process from as mentioned above a xxxx user takes... (1 Reply)
Discussion started by: kirankrishna3
1 Replies

8. Shell Programming and Scripting

Help with shell script to run a converter process

Hi, I have about 500 binary files. I have a command to convert these files to text. The command usage is: converter bin-file txt-file I have to input the name of the binary file and the name of the text file. I'm thinking something like this will work, but not really sure: for file in... (1 Reply)
Discussion started by: bbbngowc
1 Replies

9. Shell Programming and Scripting

Run shell script as a daemon

I have simple shell script that I run as cron job every hour of the day. I would like to make it a daemon that runs far more frequently like every 30 seconds or so, but I have never made daemon before. How can I do this? -Sam (7 Replies)
Discussion started by: Sammy_T
7 Replies

10. Programming

What is a daemon process?

This is gonna seem really silly to almost evryone here - but I need to know : what is a daemon process? Thanks (6 Replies)
Discussion started by: Kanu77
6 Replies
Login or Register to Ask a Question