Solved

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

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

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
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é.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

730 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