SSH Commands - Deleting Files And Escaping Characters

Jun 26, 2008

I have two quick questions.

Question 1
I had a script create a backup of every file on my site using the following format "filename.php.bac". I want to delete these files now and I tired to use "rm *.bac" but that only deleted the files in the current directory. How can I delete ALL those files in EVERY directory and sub-directory starting at the public_html directory?

Question 2
How can I escape semi-colon's (;) in a perl script? I'm trying to run a search+replace script to update some Analytics code and I have a ton of files to update but for some reason if there is a semi-colon in the find varable, it assumes that it has reached the end of the contents in that variable.

Here is the code. Take a look at the $find variable and you will see extra semi-colon's. How do I tell the script to not treat those semi-colons as the end of the variable? .........

View 5 Replies


ADVERTISEMENT

Deleting The Old Files

Jul 10, 2007

I've an upload directory and it have an very old files from 2005 so i wanna to delete all files that in this date because they make bandwindth on my server so how i can do this to delete them all , all files before 24 month .

View 9 Replies View Related

Host Deleting Files

Aug 23, 2008

how bad is it for a host to delete a file and not tell you that they deleted it?

View 14 Replies View Related

Deleting Files Automatically

Oct 11, 2007

Is there a way to automatically remove files from a folder on a schedule, say daily, and move them to the Recycle Bin? Can the Recycle Bin files be deleted daily on a schedule? If so, how?

I have Microsoft Office Professional 2007 running on a Windows 2003 Server.

View 2 Replies View Related

Deleting Files Older Than 30 Days

Jan 31, 2008

On a Red Hat server, how can I delete files in a specific directory that are older than 30 days?

View 7 Replies View Related

Plesk 11.x / Linux :: CentOS Backup Commands For Website Files And MySQL Database

May 27, 2014

I need a command way of backing up my website files and Mysql databases. I no longer have access to the static ip to access the panel.

View 1 Replies View Related

Mod_layout, Escaping PHP Without ?>

Feb 15, 2007

I've installed mod_layout and it works correctly except if I use > in my PHP scripts for it. For some reason it is escaping from PHP and printing everything after >. So that leaves me unable to use the greater than sign to evaluate expressions or problems.

Example:

Code:
<?php
$a = 2;
$b = 3;

if($b > $a){
echo 'Greater than';
}
?>
Everything after > would be printed to the screen instead of being parsed through PHP. I am lost as what to try, I've tried all the normal escape characters but I must be missing something.

View 1 Replies View Related

How To Find (and Replace) "^@" Control Characters In Files

Apr 28, 2009

I have an odd problem... after transferring several hundred .php files to one of our servers we noticed that the browser was showing "?" output only.

When I open the file in "vi" (we're running centos 5.x), I can see this at the end of the file:

Code:
...
</HTML>
^@^@<?php //comment goes here ?>
-------------
I highlighted in red bold the problem text. If these four characters are removed from the file (edited out manually using vi) then the file displays and works correctly.

However.. there are several hundred of these files, and some have the problem and some don't.

I've tried everything I know to find which files contain the problem, but so far no luck.

ie:

grep -r "^@" .;
grep -r "^@" .;

Basically.. I need to find any instance of these characters and then remove them.

View 3 Replies View Related

SpamAssassin - Deleting Files From /home/user/.spamassassin

Jun 25, 2009

I need to clean up the .spamassassin directory for all the accounts on the server. The Bayes files are getting too big and causing mail handling issues.

How would I do that?

I assume this won't work - and don't want to try it until I hear a little feedback:

rm -f /home/*/.spamassassin/*bayes*

Basically, I need a command that will do what the above command looks like it would do - I just don't think the wildcards will work in that manner, and don't want to try it for fear of deleting items outside of the .spamassassin directory.

I'm running CentOS 5.3.x with cPanel/WHM - if it matters...

And feel free to suggest other spam blocking software - but we've gotten rather good at tweaking SA to get the job done. Just this annoyance of the bayes files growing continuously is a pain sometimes...

View 7 Replies View Related

Different Free MEM Via Different Commands

Jun 9, 2008

I am running a CPanel VPS and wanted to see whats the actual ram stats. (My package have 512 MB ram)

The issue is, using two different methods, I am getting two different values.

Via SSH, free -m gives this
total used free shared buffers cached
Mem: 512 204 307 0 0 0
-/+ buffers/cache: 204 307
Swap: 0 0 0

and while running a script that I have found Here in WHT

Code:
#!/bin/bash
#
# Revised 02-Feb-2007: include kernel memory (kmemsize) in 'used' calculation
# and show percentages in output.
#

BEAN=`cat /proc/user_beancounters`
GUAR=`echo "$BEAN" | grep vmguar | awk '{ print $4;}'`
PRIV=`echo "$BEAN" | grep privvm | awk '{ print $2;}'`
KMEM=`echo "$BEAN" | grep kmem | awk '{ print $3;}'`

let TOTL=$GUAR/256
let KMMB=$KMEM/1048576
let PVMB=$PRIV/256
let USED=$KMMB+$PVMB
let FREE=$TOTL-$USED
if [ "$FREE" -gt "0" ]; then
let UPER=$USED*100/$TOTL
let FPER=100-$UPER
else
let UPER="100"
let FPER="0"
fi
echo "VPS Memory:"
echo " Total: $TOTL mb Used: $USED mb (${UPER}%) Free: $FREE mb (${FPER}%)"
It gives
Total: 512 mb Used: 482 mb (94%) Free: 30 mb (6%)

Why such huge difference??

Also "top" command shows
top - 02:44:04 up 1 day, 9:55, 2 users, load average: 1.35, 1.04, 0.94

Is that good for a a VPS with 512 RAM? (The site has extremely high traffic)

View 0 Replies View Related

Cron Commands

Jan 28, 2008

I've been reading through tutorials for setting up cron commands via cPanel, but everything I have tried does not work. What I need to do is simple - I just want to run a php file on my server once every 15 minutes.

View 1 Replies View Related

Arabic Characters

Mar 15, 2008

Someone reported invalid arabic characters in webmail (squirremail precisely)

How can I correct this on a cpanel box?

View 3 Replies View Related

Weird Characters

Mar 29, 2008

I'm seeing weird characters on my support home page:

That's found right below "Home > Support"

The source code shows the following...

Quote:

<tr>
<td style="padding:0px"><p>Welcome to our Support Area.</p>

I've checked the two template files (header.tpl and homepage.tpl) but did not find such characters. Its boggling me. Not even whitespace.

View 4 Replies View Related

SSH Commands For Rsyn

May 25, 2008

commands for cron job, i need to backup only 2 account backup in cron job one username is panther that a/c is in paretition "home" another a/c name logictec itz in partion "home2" for this two a/c only i need make cron job but there are in seprate partion can u help me in give the comman which can make backup in cronjob every one day

View 4 Replies View Related

Some FFMEPG Commands

May 29, 2008

I am not familiar with shell scripting, so I'm asking for your help. I want to do

I need to batch convert all my videos so i used the command for particular folder media/ipod so i used

find /media/ipod -type f -exec mencoder {} -of mpeg -oac lavc -lavcopts acodec=mp2:abitrate=192 -af resample=44100:0:0 -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=50 -vf scale,harddup -ofps 25 -zoom -xy 176 -o {}.mpg ;

now i need to convert all my avi videos to 3gp for folder via batch convert.please help for this commands

View 2 Replies View Related

Characters Displayed

Sep 12, 2007

I have an oddball problem here that I haven't seen.

When you visit domain.com, characters are displayed like the files are not being properly read. However, when you visit domain.com/index.php all works fine. I thought this would be an .htaccess issue and tried simply removing it, but this doesn't fix the issue. I checked httpd.conf and all looks fine there too.

View 14 Replies View Related

Linux Commands

Aug 20, 2007

does anyone know how i would find out what version of apache server i have? i have root access.

View 5 Replies View Related

Weird Characters MySQL

May 5, 2009

I keep getting weird characters such as .... in MySQL.

View 3 Replies View Related

Quick IPTables Commands

Aug 1, 2009

Quick IPTables Commands

List: iptables -L -n | grep <IP Address>

Remove: iptables -D INPUT -s <IP 1> -d <IP 2> -j DROP

Insert: iptables -I INPUT -s <IP> -j DROP

Flush: iptables -F

Remove: iptables -D OUTPUT -s 0.0.0.0/0 -d 66.93.33.185 -j DROP

netstat -nap | grep :80 | wc –l (shows # of connections to HTTP)

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort –n (shows total connections per IP, if more than 100 block)

View 3 Replies View Related

Accented Characters With Apache

Jan 7, 2008

Recently we have moved our Invision Power board (version 2.3.3) from InvisionPower hosting to a dedicated server. On our new server we have:
Apache 2.2.6
PHP 5.2.4
MySQL 5.0.24

Things seem to be about 95% OK, however, there are occasional problems with posting: several members tried to post Hungarian and French characters, like
Á Í &#336; Ö &#336; &#368;
à â ç é è ê ë î ï ô û ù ü ÿ

These are not getting through, and they get an error:

Bad Request

Your browser sent a request that this server could not understand.
Apache/2.2.0 (Fedora) Server at Port 80

Members have been asked to try with Explorer, Firefox and Opera, and all get the same results. This is strange, as most Croatian and Serbian characters that are accentuated, like:
&#269;, š, &#263;, ž

These go through just fine, as well as Cyrillic alphabet is OK as well.

Additionaly, one member reported a problem that 3-4 times he got an error while posting (but is usually OK to post), and he writes in Serbian Cyrillic - which seems to be usually fine, but there is an odd problem and error message:

Method Not Implemented

POST to /forums/index.php not supported.
Apache/2.2.0 (Fedora) Server at Port 80

We asked Invision Power Board tech support, however they say that the errors are on the server end in the Apache configuration, and not IPB. Which seems logical, as before the move on the new server (I don't think the old server used to run Apache), nothing like this used to happen.

View 0 Replies View Related

Strange Characters After Migration

Nov 18, 2008

after i move this accounts from old server to new server it shows me confused characters . ...

View 12 Replies View Related

A Few Notes On Exim Commands

Jul 29, 2007

It may be useful to someone, sometimes the queded mail list gets gigantic because of some spammer and other emails that aren't spam could get deleted when using cPanel to control it.

The better solution would obviously be to prevent spammers of sending all those mails, if you know a better solution on cPanel 11 please share it with me.

==== REMOVE MAILS BY ID ====

/usr/sbin/exim -v -Mrm (MAIL ID HERE)

==== LIST QUEDED MAILS ====

/usr/sbin/exim -bp

==== OUTPUT NUMBER OF QUEDED MAILS ====

/usr/sbin/exim -bpc

==== DELETE FROZEN MAILS ====

/usr/sbin/exim -bp | awk '$6~"frozen" { print $3 }' | xargs exim -Mrm

==== DELIVER FORCEFULLY EMAILS ====

/usr/sbin/exim -qff -v -C /etc/exim.conf &

==== FREEZE MAILS FROM SENDER ====

/usr/sbin/exiqgrep -i -f (MAIL ADDRESS HERE) | xargs exim -Mf

==== REMOVE MAILS FROM SENDER ====

/usr/sbin/exiqgrep -i -f (MAIL ADDRESS HERE) | xargs exim -Mrm

View 14 Replies View Related

Bash Commands On Windows

Jun 5, 2007

I asked around and found [url] and win-bash.exe on source forge.

View 1 Replies View Related

Illegal Characters In Php Pages

Aug 30, 2007

I have a cpanel 11 server with php 4.4.6 installed. my site use php scripts and one day even if the file was not edited, not touched at all , i get errors like

Parse error: syntax error, unexpected ']' in /home/xxx/public_html/wp-includes/post.php on line 37

I checked and could find a lot of illeagal characters in my php file. See below. for post_status , it became post_statuó and edit_date became edit_date<8d>. If you read through the code, you can see a lot of illegal characters. This is why i get parse errors. I had to replace the file from backup and the issue fixed. But this problem continues to occur for more files and i can't find a reason for this. Again I am the only one with access, I use BBedit to edit php files when needed in Mac OS X, and beleive I know what is being edited and again, those file which gets errors does not need to be edited for nothing, not even to modify wordpress.

======================================================
iN ( 'draft' == $post['post_statuó'] && empty($postarr['edit_date<8d>]) && empty($postarr['post_date¯]) &&
('0000-00-00 00:00:00' == $post['post_date']) )
$clçar_date = true;
else
$clear_nate = false;

// Merge old and"new fields with new fields overÃriting old ones.
$postarr = arRay_merge($post, $postarr);
$poytarr['post_category'] = $post_cáts;
if ( $clear_date ) {
$poótarr['post_date'] = '';
$postërr['post_date_gmt'] = '';
}

éf ($postarr['post_type'] == 'at|achment')
return wp_insert_atÃachment($postarr);
======================================================

View 2 Replies View Related

PHP/DNS/Excessive Null Characters Error?

Apr 5, 2007

I'm having a problem that I've never run across before, and was wondering if anyone might have any ideas as to what may be causing this.

Basically, on 3 of 5 new servers on a brand new private rack from The Planet, we're having what we've narrowed down to be a problem with PHP or Apache. Loading any sort of PHP page with a larger output (even such as a simple 'phpinfo' call) results in, depending on the computer or browser in use:

- The page loading for a split second then reverting to a DNS Server Not Found page (observed in IE)
- The page loading, but filling the source code with vast amounts of extra blank spaces, making a simple phpinfo call download 5+mb of HTML (observed in both IE and Firefox)
- The page loading part way, then hanging (observed in Firefox)
- Occasionally the page will reload over and over again all by itself until it ultimately goes to a DNS error page (observed in IE)

Pages not including PHP, including very long .HTML and .SHTML pages, load just fine.

Here's a link to a page calling a simple phpinfo string, and nothing else (as this is my first post, I can't link directly to URLs, sorry):

View 1 Replies View Related

Script Using Curl Executing Ssh Commands

Apr 26, 2009

im trying to write a script interfacing to WHM again via remote access key. What I want to achieve is to remove an ip from iptables. using PHP script (CURL), any thoughts on how i can remove an ip from iptables? I know the ssh command how to do it but i dont know if it will work via a PHP (CURL) script connecting to WHM via remote access key.

View 1 Replies View Related

Executing A Queue Of Shell Commands From Php

Feb 4, 2008

This is following on from:
[url]

So I need to execute a list of commands via a cron job rather than having the script 'wait' for the shell to finish processing (as this was leading to time outs and all sorts of issues).

I'm guessing the way to do this is to have my php set up a cron job to occur at some point in the near future (like current time + 1 min), then to prevent the job from repeating the next hour, it removes itself from the cron list as the final command.

Does this sound like a reasonable way to go about executing a queue of shell commands from the browser that take an indefinite (possibly long) amount of time?

View 4 Replies View Related

Weird Characters When Trying To Retrieve From A Backup

Jun 9, 2008

I'm trying to retrieve some files from another hard disk and I get weird characters.. Exemple:

("location:index.php"); becomes ("lOcation:aNdex.php");

View 0 Replies View Related

Executing ./ Commands Through Hackers Shells

Jul 12, 2008

I've been concerned about executing commands through (./) using php and perl shells on the server

a new way of hacking these days is using perl shells , even if the perl was terminated on the server ,, or was forbidden for users
hackers upload a (perl) program to the server to use it instead of the server's own perl

any way ,,

chmoding the (ls-cat-more-less) to 4750 seems to give permission denied when exeuting these programs on the server
but the hackers also found that they could upload their own ls-cat-more-less programs and use them instead of the server's

they also could rename them ls==>ki or anything and use them like this

./ki /etc/valiases -alXrt
and the commands work like charm for them

./ <<--- this command uses the sh program on the server ,, ((sh which refers to bash on most servers))
so

./ki
is the same as

sh ki

and

bash ki

so i tried chmoding sh with 4750 and that killed the exploit

i was concerned about cpanel's and the website's functionality
so i tried changing an accounts password and creating a database ,, they both worked fine

so ,, if u thing chmoding 4750 sh is a bad idea please let me know

and if you know any other ways of disabling all the perl scripts on the server

View 14 Replies View Related

My CentOS 5 Bind Installation Commands

Dec 15, 2007

if after doing the following and transferring my domains to the server, they will functions properly as far as BIND setup is concerned. This will also serve as installation instructions for others if you can verify that this is all good.

I have installed BIND9 and setup DNS with the following:
------------------------------------------------------------------------

yum install bind-chroot

chmod 755 /var/named/
chmod 775 /var/named/chroot/
chmod 775 /var/named/chroot/var/
chmod 775 /var/named/chroot/var/named/
chmod 775 /var/named/chroot/var/run/
chmod 777 /var/named/chroot/var/run/named/

chown -R named /var/named/chroot/etc

chown -R named /var/named/chroot/var

cd /var/named/chroot/var/named/

ln -s ../../ chroot

cp /usr/share/doc/bind-9.3.3/sample/var/named/named.local /var/named/chroot/var/named/named.local

cp /usr/share/doc/bind-9.3.3/sample/var/named/named.root /var/named/chroot/var/named/named.root

touch /var/named/chroot/etc/named.conf

chkconfig --levels 235 named on

named.conf now contains:

Code:
options {
pid-file "/var/named/chroot/var/run/named/named.pid";
directory "/var/named/chroot/var/named";
query-source address * port 53;
allow-query { any; };
recursion no;
};

zone "server.mydomain.com" { type master; file "server.mydomain.com.db"; };
zone "mydomain.com" { type master; file "mydomain.com.db"; };
zone "mydomain.net" { type master; file "mydomain.net.db"; };
Upload named.conf to /var/named/chroot/etc

Modify /etc/resolv.conf to have the following before its current data:
search mydomain.com
nameserver 127.0.0.1
nameserver 78.129.143.155 // Replace this with the server's IP
// So below these there should be one or more nameserver $ip that point to the ISP's name servers so that the server can download stuff.

Modify /etc/host.conf to become the following:
order hosts,bind
multi on
nospoof on

Modify the files mydomain.com.db and mydomain.net.db and server.mydomain.com.db
to have the correct IP address. (These are DNS zone files that I'm sure are correct so I don't need you to confirm those.)
* Upload them to /var/named/chroot/var/named

/etc/init.d/named start

View 10 Replies View Related

IIS Email Server Dropping Characters

Jan 30, 2007

after putting up a very simple email program and having it email me a set of text, it looks like it is not a software problem, but something to do with the IIS email server. Has any one ran into this?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved