Link to home
Start Free TrialLog in
Avatar of d_terano
d_terano

asked on

using cron

Hi there,

i've 2 questions:

Question 1 (using cron)
---------------------------
I'm trying to make a script work every 5 minutes. This is what i've done. Do tell me what is wrong and how to rectify the problem:

1. in the command prompt> crontab -e

2. I inserted this line to make the script run every 5 minutes. (the script is stored on my Desktop)

5 * * * *  userName   /home/userName/Desktop/scriptName

Then i saved and exited the file. Afterthat i waited for 5 minutes and more... but nothing happens... what's wrong?

Instead of running a script, i run a command instead for example:

5 * * * * userName /bin/echo cron successfull

Again, nothing happens...

Question 2 (script -> executable)
--------------------------------------
After writing a script, running it would mean prompt> ./scriptName arg1 arg2 ...
however, is it possible to make that script into an executable file? How?

Thanks.

d_terano
Avatar of liddler
liddler
Flag of Ireland image

1. You've tod it to run at 5 minutes past each hour, you need:
0,5,10,15,20,25,30,35,40,45,50,55 * * * *  /bin/echo "cron successfull"
2. A script is made executeable using chmod a+x scriptName.
Or do you mean compiling a script into a binary file (Usually to stop people looking at the source code)
Avatar of Fredericl
Fredericl

You need to restart Crond to activate changes.

type this command:
service crond restart

" You need to restart Crond to activate changes. "

No you dont.
Avatar of d_terano

ASKER

liddler,

I'll try ur suggestion ASAP. As for the question 2.... yes i mean to prevent people looking at the source code...

do i use "make" to do that? if yes, are there any other way to do it besides using "make"?

thanks

regards,
d_terano


for Q1:
--------

I've tried out the suggestion given by liddler. This is the error message that was mailed to me:

From root  Tue Nov 11 12:05:00 2003
Return-Path: <root@localhost.localdomain>
Received: (from root@localhost)
        by localhost.localdomain (8.11.6/8.11.6) id hAB250B02246
        for root; Tue, 11 Nov 2003 12:05:00 +1000
Date: Tue, 11 Nov 2003 12:05:00 +1000
Message-Id: <200311110205.hAB250B02246@localhost.localdomain>
From: root@localhost.localdomain (Cron Daemon)
To: root@localhost.localdomain
Subject: Cron <root@localhost> root /bin/echo crond successfull
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>

/bin/sh: root: command not found


What's wrong?


for Q2:
--------

is it possible to use "make" to convert a bash script to an executable (binary) file?

thanks.
ASKER CERTIFIED SOLUTION
Avatar of liddler
liddler
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
liddler,

thanks a lot for your help! appreciate it...

regards,
d_terano