Solved

using cron

Posted on 2003-11-10
8
468 Views
Last Modified: 2013-12-16
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
0
Comment
Question by:d_terano
8 Comments
 
LVL 18

Expert Comment

by:liddler
ID: 9715424
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)
0
 

Expert Comment

by:Fredericl
ID: 9718307
You need to restart Crond to activate changes.

type this command:
service crond restart

0
 
LVL 17

Expert Comment

by:owensleftfoot
ID: 9718702
" You need to restart Crond to activate changes. "

No you dont.
0
 

Author Comment

by:d_terano
ID: 9719007
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


0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 18

Expert Comment

by:liddler
ID: 9720993
0
 

Author Comment

by:d_terano
ID: 9730447
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.
0
 
LVL 18

Accepted Solution

by:
liddler earned 50 total points
ID: 9730520
1. you sohuldn't have the username (root) in there
0,5,10,15,20,25,30,35,40,45,50,55 * * * *  /bin/echo "cron successfull"
not
0,5,10,15,20,25,30,35,40,45,50,55 * * * *  root /bin/echo "cron successfull"
2. No, make is used for turing .c, .o, .h etc type files into c binaries using a C compiler, not converting shell scripts to binaries
0
 

Author Comment

by:d_terano
ID: 9735743
liddler,

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

regards,
d_terano
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now