Sponsored Content
Top Forums Shell Programming and Scripting CRON shell script only runs correctly on command line Post 302484357 by louieaw on Thursday 30th of December 2010 06:12:59 PM
Old 12-30-2010
Well, because of the firmware, though it is unix based, it requires that you specify a user in the cron file.
Check it out here: http://www.dd-wrt.com/wiki/index.php/CRON (Darn thing won't let me post real URLs yet)

That been my holy book for this project.

I think you might be right about the PATH thing. (I also have a theory that something with the quotes is messing it up) Whatever it is, I realized ssh doesn't output when run from cron. With that being said:

I actually managed to get some sort of workaround that does just fine.

- I made a script on the remote machine that does the query and then outputs the code to a file named 'codelog'
- The script on the router runs, sshes, and executes the script on the remote machine
- Then, the script runs 'scp' to copy the 'codelog' file from the remote machine to the router
- Finally, I set the output of 'cat codelog' as my variable.
- And well, it works!


Thanks so much!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script runs fine, but not in a cron

Okay, I have the following script that runs fine from a command line as well as an executable .sh file. It just moves any file/folder with movie* in the name to a folder called _Movies. The issue I'm running into is when it's call from a cron. find /mnt/HD_a2/BT/complete -iname "movie.*" -exec... (4 Replies)
Discussion started by: sammyk
4 Replies

2. Shell Programming and Scripting

Shell script runs fine in Solaris, in Linux hangs at wait command

HI, I have a strange problem. A shell script that runs fine on solaris. when i ported to linux, it started hanging. here is the core of the script CFG_FILE=tab25.cfg sort -t "!" -k 2 ${CFG_FILE} | egrep -v "^#|^$" | while IFS="!" read a b c do #echo "jobs output" #jobs #echo "jobs... (13 Replies)
Discussion started by: aksaravanan
13 Replies

3. Shell Programming and Scripting

Script runs manually but not correctly from crontab

Hi all I have this inside a shell script (bash): cd DIRECTORY find . -maxdepth 1 | sed 's#./##' | /usr/bin/xargs -I '{}' chown -Rv '{}' /DIRECTORY/'{}' All the directories in this location are named after usernames, so it simply sets the owner to that of the username of the folder. It... (5 Replies)
Discussion started by: fakesy
5 Replies

4. Shell Programming and Scripting

Script runs manually but not correctly from crontab

Hello all, I'm new here and have a question if you don't mind helping me. I have a script that will work if I kick if off manually but not from Cron. My cron entry is this: 05,20,35,50 * * * * /scripts/status.sh > /dev/null 2>&1 The first script (works fine) is this: #!/bin/sh # #... (14 Replies)
Discussion started by: hs3082
14 Replies

5. Shell Programming and Scripting

Shell Script runs good manually but not through Cron tab

Hello Every one, I have a shell script which is running fine manually, but its giving me hard time when running tru cron job. :wall:. Am using #!/usr/bin/ksh >echo $SHELL /usr/bin/ksh Cron Job is as below, it execues but dosent do what i want it to do. 47 15 * * *... (1 Reply)
Discussion started by: naren.chowdhary
1 Replies

6. AIX

Script runs in shell but not cron

We run some menu driven software that has the ability to batch menu paths and generate reports quickly. Normally you run a batch like: $ BATCH BATCHNAME The batch program then prompts you for the date you want the report run for. I got some help from some folks on IRC to do the following: BATCH... (2 Replies)
Discussion started by: herot
2 Replies

7. Shell Programming and Scripting

Odd results when my script runs from cron..

Hi folks, So I wrote a script to run "top", "awk" out values fro the "top" and send the results to a data file. I then set it to run in cron every 15 minutes. Now I'm noticing that the script, and it's sub-commands are not always cleanly finishing and, in my investigations, I am also... (11 Replies)
Discussion started by: Marc G
11 Replies

8. Shell Programming and Scripting

Script runs in command-line fine but times out in CRON?

Hi, I have a script that seems to run to completion when in the command-line, but when it is run using the cron, it seems to time out. They both start and run fine, but on the CRON it stops prematurely. The script hits an API every few seconds and grabs data. Does anyone have any idea on... (4 Replies)
Discussion started by: phpchick
4 Replies

9. Shell Programming and Scripting

Sql command inside shell script runs without giving anything back as outout

#!/bin/sh # This script returns the number of rows updated from a function echo "The execution is starting ....." sqlplus -silent $UP <<EOF set serveroutput on set echo off set pagesize 0 VAR no_rows_updated NUMBER; EXEC :no_rows_updated :=0; DECLARE CURSOR c_update is SELECT * FROM... (4 Replies)
Discussion started by: LoneRanger
4 Replies

10. Shell Programming and Scripting

Script runs manually, but not from cron

Hi, I "borrowed" a script I found online, to start a SAP router application on a Solaris 11 (SPARC) server. The script runs fine when calling it manually, but when I schedule it to run from cron, it doesn't. I don't see any warning or failure messages anywhere, just nothing happens. ... (11 Replies)
Discussion started by: bredman
11 Replies
Poll(4) 						     Kernel Interfaces Manual							   Poll(4)

NAME
Poll - Contains information specifying when the UNIX-to-UNIX Copy Program (UUCP) should poll designated remote computers SYNOPSIS
/usr/lib/uucp/Poll DESCRIPTION
The /usr/lib/uucp/Poll file contains information for polling remote computers. Each entry in the Poll file contains the name of a remote computer to call, followed by a <TAB> character, and a sequence of hourly intervals expressed in digits. These are the hourly intervals at which the local system polls a remote system; you must specify interval times as digits between 0 and 23. The format of entries in the Poll file is: sys-name<TAB>hour Note that you must be logged in as root to edit the Poll file, which is owned by the uucp login ID. The Poll file is used with the crontabs/uucp file, the uudemon.hour script, and the uudemon.poll script. Together, these files are respon- sible for initiating automatic calls to remote systems to perform certain maintenance tasks. EXAMPLES
The following example provides polling of computer eagle every 4 hours: eagle 0 4 8 12 16 20 The follwing example provides polling of computer hera every hour: hera 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 FILES
Contains all the configuration files for UUCP, including the Devices file. Describes accessible remote systems. Initiates file transport calls to remote systems. Polls remote systems listed in /usr/lib/uucp/Poll file. The uucp file that contains instructions for the cron daemon. RELATED INFORMATION
Commands: crontab(1) Daemons: cron(8) delim off Poll(4)
All times are GMT -4. The time now is 10:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy