Setting up a Daemon in UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Setting up a Daemon in UNIX
# 1  
Old 10-02-2013
Setting up a Daemon in UNIX

I have scheduled a crontab job in AIX 6.1 OS to run twice in an hour which runs for the whole day to process a load.

The load which crontab kicks off needs files to arrive at a particular directory and if the files arrive, I process them.

It so happens that for the 24 times the crontab kicks off my load there would be only 7 times I actually receive the files and for the rest of the times I receive no files and the load reports saying that no files received and I cannot predict when files arrive as it can arrive anytime.

I heard that a DAEMON can be setup in Unix which can monitor for files arriving at a particular destination and call other scripts after that.

I was thinking if it were possible to create a daemon to monitor a particular destination and if files are present, It can call a shell script.

Is this possible, if yes how can I code the daemon. I have no prior experience with daemons.

Can anyone provide a sample for the same.
# 2  
Old 10-02-2013
with bash:

Code:
#!/bin/bash
while true
do
    # add code to monitor dir here and take same action
done


Code:
nohup monitor.sh &

This User Gave Thanks to Expect For This Post:
# 3  
Old 10-02-2013
Remember that you would have to be sure that the fail arrival had completed before you take any action. We achieve this by each process that delivers a file having to send a follow up flag. If the file in question is inventory then we would watch for inventory.ok or something similar of your choosing to confirm that the delivery has completed. That way, your sending process can also perform some checks that the entire file has been delivered.

We have some large files that go across public networks so can take 3 hours to transmit, and errors (and therefore a re-send) occur a few times a month. Only when we are happy that our data send is complete to we send over the OK file and processing on the other side triggers in.



Robin
Liverpool/Blackburn
UK
This User Gave Thanks to rbatte1 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Setting up a path in UNIX

I have the following script "test". When i tried to execute it, I am not able to run it. I dunno why ? Then i tried getting the first few lines of the script which is displayed below: $head -10 test #!/bin/ksh PROG=$0;export PROG ORAUSER=`get_inf_env INFORM_DB_ACCOUNT`;export ORAUSER... (13 Replies)
Discussion started by: bobby1015
13 Replies

2. UNIX for Dummies Questions & Answers

Setting a variable in unix

Hi , Whenever i want to start tomcat server I need to go to <tomcatdir>\bin and execute startup.sh file. How would i make this happen whenever i start my machine? Also want to know How would i set the variable at startup. for example I want to set JAVA_HOME and JRE_HOME whenever the... (3 Replies)
Discussion started by: pinga123
3 Replies

3. Shell Programming and Scripting

How to write daemon in UNIX

Hi Guys, I hope this is the right forum to post this. I have a directory where files will be dumped at any time of the day and I want to run scripts as soon as new files come into the directory. How can I write a daemon that detects when new files have been uploaded to the directory? ... (1 Reply)
Discussion started by: regie101
1 Replies

4. Shell Programming and Scripting

How to write a daemon in Unix?

Hi I have a directory where sometimes a file will come (in a name format say file001.txt). I want to run a job (.ksh file) as soon as a new file comes into the directory. How can I write a shell script which will run in the background and monitor arrival of new file in the directory? ... (11 Replies)
Discussion started by: sbasak
11 Replies

5. Shell Programming and Scripting

créating a daemon under unix

hi i want to create a daemon under unix or linux but i don't really know how so i will be grateful if you provide me links with examples or /andx how to do it thanks (2 Replies)
Discussion started by: student00
2 Replies

6. Linux

setting daemon umask

I was asked to change the daemon umask on my RHEL4 machine. so, i changed the /etc/init.d/functions file. Does this take effect right away? I dont think it does, how can i get it to take affect without rebooting? (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies

7. UNIX for Dummies Questions & Answers

I would like to know Would you run the ‘identd’ daemon on UNIX servers?

Would you run the ‘identd' daemon on UNIX servers? can you please Explain. thanks in advance! (3 Replies)
Discussion started by: xoxouu
3 Replies

8. UNIX for Dummies Questions & Answers

Should a UNIX daemon process close open fds?

I have a UNIX daemon process that's been started by a parent process, an application server. The behavior of this daemon process is to inherit and use the app server's file descriptors (ports/sockets). When I shutdown the app server, the daemon continues to run, because there may be other... (1 Reply)
Discussion started by: kunalashar
1 Replies

9. IP Networking

really really really new to unix...need help setting up dsl

I just installed solaris 8 on my comp....NIC was recognized at startup so it's allrite... for hostname I so far put hostname and for the IP I put in the 192.168.0.XX can anyone instruct me step by step on what I should change and how about would I go seeting up the dsl connection ... ... (2 Replies)
Discussion started by: czoka
2 Replies
Login or Register to Ask a Question