Sponsored Content
Top Forums Shell Programming and Scripting Script runs but does not execute rm -rf command Post 302772388 by MrBiggz on Monday 25th of February 2013 10:08:15 AM
Old 02-25-2013
Script runs but does not execute rm -rf command

Hi!

First off I'm no bin/bash script writer! Smilie I can make heads and tales of it from the php experience I have and that's all.

Now I managed to piece this script together to go look at directory and remove files that are +60 days. It's finding the files but its not removing them. I believe I have the command right.

Here's my script albeit short ..

Code:
#!/bin/bash
IFS=”$”
cpanel_username=*********
domain=ftsoccerclub.org 
username=mflores
cd /home/${cpanel_username}/mail/${domain}/${username}
find -P /home/${cpanel_username}/mail/${domain}/${username}/* -mindepth 1 -maxdepth 1 -mtime +60 | while read old; do
echo “Deleting ${old}…”
rm -rf “${old}”
done

and then I'll get an email from the server telling me ...

Code:
“Deleting /home/ftsoccer/mail/ftsoccerclub.org/mflores/cur/1352080174.H191427P31791.aegis.provim.net,S=5532:2,…”
“Deleting /home/ftsoccer/mail/ftsoccerclub.org/mflores/cur/1352906954.H115090P16065.aegis.provim.net,S=17638:2,…”
“Deleting /home/ftsoccer/mail/ftsoccerclub.org/mflores/cur/1353454848.H164807P5507.aegis.provim.net,S=5482:2,…”
“Deleting /home/ftsoccer/mail/ftsoccerclub.org/mflores/cur/1352658395.H166861P17720.aegis.provim.net,S=23414:2,…”
“Deleting /home/ftsoccer/mail/ftsoccerclub.org/mflores/cur/1353519624.H550535P18176.aegis.provim.net,S=5236:2,…”
“Deleting /home/ftsoccer/mail/ftsoccerclub.org/mflores/cur/1352724748.H508350P20254.aegis.provim.net,S=23200:2,…”
“Deleting /home/ftsoccer/mail/ftsoccerclub.org/mflores/cur/1351785142.H117822P22505.aegis.provim.net,S=11548:2,…”
“Deleting /home/ftsoccer/mail/ftsoccerclub.org/mflores/cur/1352287307.H69509P3896.aegis.provim.net,S=26245:2,…”
“Deleting /home/ftsoccer/mail/ftsoccerclub.org/mflores/cur/1353537904.H596136P16093.aegis.provim.net,S=77013:2,…”
“Deleting /home/ftsoccer/mail/ftsoccerclub.org/mflores/cur/1352129497.H679409P15661.aegis.provim.net,S=15964:2,…”

and if I go back to that directory .. the file still stands! |=

The permission on the file(s) is 660

The cpanel username I use is like God on here so I don't think it's a permission issue .. then again I could be wrong!

Any help would be greatly appreciated!

Last edited by Scrutinizer; 02-25-2013 at 12:29 PM.. Reason: quote tags => code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script to execute user command

I don't know why the following shell script doesn't work. Could you please help me out? #!/usr/bin/ksh test="cal > /tmp/tmp.txt 2>&1" $test I know it will work for the following format: #!/usr/bin/ksh cal > /tmp/tmp.txt 2>&1 However, I need to get the command from the user in... (1 Reply)
Discussion started by: redtiger
1 Replies

2. Shell Programming and Scripting

how to execute a sh command from a csh script

Hi everyone, I have a csh script that works fine but the output of an rsh command is different if I use boune shell instead cshell. Is there the possibility to execute only this command in bourne shell from a script declared cshell? Thanks Christian (2 Replies)
Discussion started by: bonovox
2 Replies

3. Shell Programming and Scripting

awk command in script gives error while same awk command at prompt runs fine: Why?

Hello all, Here is what my bash script does: sums number columns, saves the tot in new column, outputs if tot >= threshold val: > cat getnon0file.sh #!/bin/bash this="getnon0file.sh" USAGE=$this" InFile="xyz.38" Min="0.05" # awk '{sum=0; for(n=2; n<=NF; n++){sum+=$n};... (4 Replies)
Discussion started by: catalys
4 Replies

4. 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

5. Shell Programming and Scripting

CRON shell script only runs correctly on command line

Hi, I'm new to these forums, and I'm hoping that someone can solve this problem... To make things short: I have DD-wrt set up on a router. I'm trying to run a script in CRON that fetches the daily password from my database using SSH. CRON is set like so(in web interface): * * * *... (4 Replies)
Discussion started by: louieaw
4 Replies

6. UNIX for Dummies Questions & Answers

How to execute command after telneting in shell script?

Hi , I have to write a shell script to telnet to specific host and execute the admin command there. Please help me to do that. Eg : telnet hostname portno admin command exit (3 Replies)
Discussion started by: arukuku
3 Replies

7. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 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

Execute ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies
aegstate(5)							File Formats Manual						       aegstate(5)

NAME
aegstate - aegis global state file SYNOPSIS
/var/lib/aegis/state DESCRIPTION
The aegis state file is used to store the pointers to project directories. CONTENTS
where = [{ ... }]; This field is a table relating project name to project directory. The structure is as follows: project_name = string; The name of a project. directory = string; Absolute path of the project's directory. (Only set of alias_for is not set.) alias_for = string; This is the name of another project, possibly including branch numbers. It allows you to have shorter or more meaningful project names. (Only set if directory is not set.) WRITING REPORT SCRIPTS
When attempting to access these fields from within the report generator, you need a code fragment similar to the following: auto p; p = project[project_name()]; That is, the where field is represented by the project array variable, however, it does not mention the aliases, only the actual projects, similar to the "ael projects" command. (You can, however, index the projects array by an alias, or even by a project name with branches on the end.) In addition to the project_name and directory fields specified above, the report generator insets a state field, which gives you access to the project state fields (see aepstate(5) for more information). SEE ALSO
aegis(5) aegis file format syntax COPYRIGHT
aegis version 4.24.3.D001 Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Peter Miller The aegis program comes with ABSOLUTELY NO WARRANTY; for details use the 'aegis -VERSion License' command. This is free software and you are welcome to redistribute it under certain conditions; for details use the 'aegis -VERSion License' command. AUTHOR
Peter Miller E-Mail: millerp@canb.auug.org.au //* WWW: http://www.canb.auug.org.au/~millerp/ Reference Manual Aegis aegstate(5)
All times are GMT -4. The time now is 05:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy