check for a file and run some commands


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers check for a file and run some commands
# 1  
Old 03-18-2009
check for a file and run some commands

Hi all,

Can you guys please help me with this...

I am on AIX and need to prepare a script which will

1. check for a file named do_backup in the current file system
2. If the file exists i need to run some commands and exit, if the file doesn't exist then sleep for 15 mins and try again...

Thank you....
# 2  
Old 03-18-2009
Assuming 'do_backup' is to appear in a current directory - something to start with
Code:
#!/bin/ksh

while [ ! -e do_backup ] 
do 
   echo sleeping
   sleep 15
done

echo 'do some stuff here"

# 3  
Old 03-18-2009
thank you

thank you
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

How to run commands with pipe from text file?

Hello, I have standard loop while read -r info; do command $info done < info in info text file I have multiple commands each on line that I want to execute. When I used them in console they worked, but not with this loop. This is one of the commands in info file: grep... (4 Replies)
Discussion started by: adamlevine
4 Replies

2. UNIX for Advanced & Expert Users

FTP commands to check the file status

Hi Experts, Can some one let me know the FTP commands to check the file status i.e i want to check whether my files are locked or in open status. I am connecting FTP from local machine. Regards, Spidy (1 Reply)
Discussion started by: spidy
1 Replies

3. Shell Programming and Scripting

Csh/tcsh : Check the file existance and run the script

Hi, I've to wait until a file generated and once its generated, source another script in Linux terminal. Please help me as this is very very urgent. The code should be something like if ( -e "/abc/xyz/a.txt ) source aaa.csh else sleep This should be repeated till the if... (4 Replies)
Discussion started by: kumar_eee
4 Replies

4. Shell Programming and Scripting

Perl telnet to router run commands from file

I have a perl script that is called with a router name command list file and output file. The command file can be very large, up to 3k of commands. At first I dumped the command list file to an array and ran the entire file on the router and captured the output. It worked ok for a command list in... (1 Reply)
Discussion started by: numele
1 Replies

5. UNIX for Dummies Questions & Answers

Can you check when a file was last run?

Hi, I was wondering if there was any way in unix to check when a file was last run. I'm doing a basic menu. 1. Savefile 2. Check when SaveFile was last run. What can I use here to display when SaveFile was last run? Coding so far is if then echo Save file was last used: ... (2 Replies)
Discussion started by: Purepatch
2 Replies

6. Shell Programming and Scripting

Unix Commands to check a file is compressed or not?

Hi, I need to find out whether a file is compressed or not and based on that i need to compress that file and move it to archive folder. say for e.g: If file is compressed then just move to archive folder else compress and move end if i have implemented a... (2 Replies)
Discussion started by: kk17
2 Replies

7. Shell Programming and Scripting

Help with shell script to run the commands reading options from local file

I have to use shell script to run series of commands on another unix box by connecting through SSH and giving user credentials. For running commands on remote machine I have to use options reading from a local file. Process: Connecting to remote unix server <host1.ibm.com> through ssh Login: ... (2 Replies)
Discussion started by: itsprout
2 Replies

8. UNIX for Dummies Questions & Answers

Command to run multiple commands from a file.

I need a command, which could run mutliple commands from a file. Let's say, I have mv fileA1 fileB1 mv fileA2 fileB2 ..... mv fileA20 fileB20 I put these commands in a file, then I need a command to run the file as a whole so that I don't need to type 20 times... Anyone tell me how to... (8 Replies)
Discussion started by: kaixinsjtu
8 Replies

9. Shell Programming and Scripting

Is there any commands to check the dynamic changes of a file

Hi guys i had a script which will generate a log file.Is there any commands to check the dynamic changes in the log file,i.e if i open the log file i should able to see the updating changes live...I hope u understand my query... (2 Replies)
Discussion started by: vinoo
2 Replies

10. HP-UX

fsck! How to run Full File System Check

Dear all I am new for HP-UX. I have HP rp2470 running HP-UX 10.x When i run fsck in a root, the output is as below: #:root> fsck fsck: /dev/vg00/rlvol1: mounted file system continue (y/n)? y ** /dev/vg00/rlvol1 ** Last Mounted on /stand ** Phase 1 - Check Blocks and Sizes ** Phase... (3 Replies)
Discussion started by: hungevntelecom
3 Replies
Login or Register to Ask a Question