Bash shell script to check the if empty files are being created & start the process
I have an Ubuntu server in which a file is dumped every hour and a new file for the next hour and the process continues. If there is any problem due to which the creation of file stops then empty files are created every minute till the process is killed & started again. I need help to make a shell script to check if the empty files are being created and then kill the process and start it again.
It would be a great help if anyone can help me regarding this. |
Give this a try:
Code:
#!/bin/bash |
Thanx for the reply @ kbp
Will this above script kill and start the process "myproc" |
I'm kinda new to shell scripting and I don't have much idea about it. It would be a great help if you could help me.
In my scenario I need to run a script present in the home directory after th process is killed. Can I do it after changing your script as Code:
#!/bin/bash |
try '~/.proc.sh' .. this is the home directory of the current user or you can use the full path .. '/home/<user>/proc.sh'
cheers |
Thanks kbp.
I really needed this one. |
When is use this script everything is fine. But the problem is that all the files including data files and empty files are being removed from /tmp/test/
Code:
#!/bin/bash |
Sorry.. you didn't specify that you wanted to keep the non-empty ones :) .. try this:
Code:
#!/bin/bash |
Thanks kbp. That works fine.
|
All times are GMT -5. The time now is 08:28 AM. |