Solved

using cron

Posted on 2003-11-10
8
469 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

919 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

20 Experts available now in Live!

Get 1:1 Help Now