Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

using cron

Posted on 2003-11-10
8
Medium Priority
?
476 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
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.

 

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
 
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 200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
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.…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

596 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