Solved

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

Posted on 2002-03-18
2
181 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

896 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

15 Experts available now in Live!

Get 1:1 Help Now