cron mv command?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers cron mv command?
# 1  
Old 08-19-2005
cron mv command?

I'm using this in cron:

cd public_html/temp mv 2.php 1.php

that command, from ssh, renames the file in the public_html/temp folder from 2.php to 1.php. For some reason it's not doing it via cron, though. Any idea why? Thanks for your time.
# 2  
Old 08-19-2005
This might work a litle better:
Code:
cd public_html/temp; mv 2.php 1.php

and I don't get how your version could work from the command line either.
But who knows?
# 3  
Old 08-19-2005
Hi,

that's because when you run the script from the shell you have environment setting loaded, like PATH, LD_LIBRARY_PATH, and so on.

You should load these settings into the cron.

hope it helps.

Also remember to use absolute paths:

cd foo/foobar will work depending where am I in the directory tree.

cd /foo/foobar will work, if that directory exist.

You will know where you are stand with pwd command.
# 4  
Old 08-19-2005
Quote:
Originally Posted by jim mcnamara
This might work a litle better:
Code:
cd public_html/temp; mv 2.php 1.php

and I don't get how your version could work from the command line either.
But who knows?

that did it, thanks a bunch Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Command works at command line but not from cron

Oracle Linux 6. Trying to set up a simple monitoring of memory usage. This command does exactly what I want at the command line: echo $(date +%Y-%m-%d" "%H:%M:%S) $(grep PageTables /proc/meminfo) >> /home/oracle/meminfo.logBut when I put it in my crontab: * * * * * echo $(date +%Y-%m-%d"... (2 Replies)
Discussion started by: edstevens
2 Replies

2. UNIX for Advanced & Expert Users

Command syntax error in cron

SCO OSR 507, user's shell is old Bourne sh The same command is OK when run using now, but fails when run in cron, see below: 1) using now, see how it worked and I see resulting DT=2018 in the mail $ at now { dt=`/usr/gnu/bin/date '+%Y'`; echo "DT=$dt"; } job 1522867418.a-6605:0 at Wed... (2 Replies)
Discussion started by: migurus
2 Replies

3. UNIX for Dummies Questions & Answers

Db2 command issues with cron

Hi, I have a very simple script that queries from a DB2 table. The script has 3 parts - (i) Sets the db2profile (ii) connects to db2 using credentials (iii) executes the query.This script works fine if i run it manually from the command prompt. However when scheduled in crontab, it proceeds... (2 Replies)
Discussion started by: VeePee
2 Replies

4. UNIX for Dummies Questions & Answers

Cron the top command

Hi Greetings!!!!! I want to cron the top command 1 hour once and need to save the file in /home/dm. i am using redhat linux. (1 Reply)
Discussion started by: thangadurai
1 Replies

5. Shell Programming and Scripting

Command to stop all the cron jobs

Hi All, Please provide the command to stop all the cron jobs. Thanks in Advance Regards, Sindu (2 Replies)
Discussion started by: indira_s
2 Replies

6. UNIX for Dummies Questions & Answers

cron command validation

In cron tab, while scheduling any commands to be run in particular time, is there any level of validation being performed to identify whether the command to be executed is perfectly valid. But AFAIK, it's not being reported even if you schedule a non existing command .say tea abc, Where tea ia a... (3 Replies)
Discussion started by: pandeesh
3 Replies

7. UNIX for Dummies Questions & Answers

Need to run a command from cron

How can I run the following command from cron? tar -cvf /email_backup/email_bu_062110.tar /prod/email (2 Replies)
Discussion started by: nim73
2 Replies

8. SuSE

inconsistent ls command display at the command prompt & running as a cron job

Sir, I using the following commands in a file (part of a bigger script): #!/bin/bash cd /opt/oracle/bin ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out If I run this from the command prompt the result is: 2007-05-16 if I run it as a cron job then... (5 Replies)
Discussion started by: rajranibl
5 Replies

9. UNIX for Dummies Questions & Answers

Cron command for backups

Hello All, I am new to AIX. I come from a VAX/VMS background. I would like to find the backup procedure for my RS600. How can I see/modify an existing "cron" command that executes my nightly backup and sets the rights on files ? Thanks (2 Replies)
Discussion started by: gjarvis
2 Replies

10. UNIX for Dummies Questions & Answers

cron command not found

I'm trying to execute a command in my crontab, but every hour I'm sent mail that says /bin/bash: root: command not found Does anyone know why I'm getting that message? It was in the crontab before I started screwing around with it and it was working fine. Now that I messed with it, ran a... (4 Replies)
Discussion started by: sstevens
4 Replies
Login or Register to Ask a Question