Solved

using cron

Posted on 2003-11-10
8
474 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

688 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