Jump to content

Recommended Posts

Posted

Im looking to write a bash script I can use as a cron for a program I use. I know what it would be like in w32 .bat language, but not sure how to port it to bash script.

 

Basically, I use hellanzb for downloading from newsgroups. I dump a nzb file in a folder, and the program autodownloads it. The problem is the program keeps the connections open to the usenet server even when its not downloading.

 

So i want to write a cron that runs every 5 mins or so and checks for the existance of a .nzb in the folder, and if it finds one, itll start the hellanzb program, and if it doesnt find one, itll stop it.

 

something like this:

 

if exist /home/myname/nzb/*.nzb goto START

:STOP
/etc/init.d/hellanzb stop
goto END

:START
/etc/init.d/hellanzb start
goto END

:END

Posted

ok after a bit of googling ive come up with this:

 

if [ -e "/home/myusername/NZB/daemon.queue/*.nzb" ]; then 

/etc/init.d/hellanzb start

else

/etc/init.d/hellanzb stop

fi

 

but wont work as it can only look for a single file

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...