Solved

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

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
What is ISQL? 6 99
Best way to split and output to csv in bash 2 27
LINUX CENTOS + APACHE 9 32
Linux as a middle box 7 18
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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.:
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.

707 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

17 Experts available now in Live!

Get 1:1 Help Now