Solved

CRON won't run system commands (even as root)

Posted on 2002-03-18
2
183 Views
Last Modified: 2013-12-15
hi. I am trying to figure out why CRON *will* execute this script, but it won't actually do what it's supposed to do.

here's a copy of a simple script (/usr/local/bin/shelltest):

#!/bin/sh
groupadd mytest22



Here's my crontab file:
[root@internetsubmit internetsubmit]# crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.24499 installed on Tue Mar 19 01:14:24 2002)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
13 * * * * /usr/local/bin/shelltest


when I install as root into CRON, it will not create the group "mytest22" but if i run the script from the command line, it works fine. I've tried this on two systems (Redhat & Mandrake) and nothing. There must be something about CRON that I am overlooking...perhaps it has a safety feature?? Anyone know how to fix it so I can create users/groups into the system using CRON?


Thanks!
0
Comment
Question by:linuxnewbie7
2 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 6879211
you need to use a full path to groupadd
Also see the crontab user's mail, 'cause cron sends a mail if it fails.
0
 

Author Comment

by:linuxnewbie7
ID: 6879228
yes, I just figured that out too! Thanks! It works when used the full path
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why VNC doesn't work in Redhat? 11 72
fedora linux on laptop - setup sendmail - or some kind of email 5 55
centos commands 6 68
Linux Real Time Memory on Distinct 24 Cycle 7 29
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
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.

828 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