1
vote
1answer
50 views

cp/rsync command with destination as symlink to a directory

I am working on a cPanel backup solution at the moment. We are now informed about this exploit. Exploit : Full ROOT ACCESS to server 1.) create malicious file from, normal user account: mkdir root ...
-1
votes
1answer
207 views

Cacti Export Tool Script [duplicate]

I'm looking for any script that possible to export graph of Cacti into CSV/text format. I have several interfaces in different devices, so I want to export those graph by using cron's job for sending ...
1
vote
2answers
157 views

find: how to not have errors (stderr) when no files exists

I have a custom script which gzip log files when they are one day old. In my script all errors (stderr) are logged to a file and at the end of the script I use this file to know if its execution was ...
2
votes
2answers
478 views

Shell script command output in if condition comparison fails to compare to same value string

I'm incorporating a script snippet which determines Android version via: adb shell getprop ro.build.version.release which returns: 4.1.2 or 4.0.4 The snippet currently looks like this: if [ "$(adb ...
-1
votes
3answers
60 views

What shell scripts have run [closed]

Is there any way to determine what shell scripts ran within a certain time frame? I.e. I need to know all the shell scripts that ran yesterday between 2:00 an 5:00.
1
vote
3answers
601 views

How can I suppress the “…this does not map back…” message when using SSH?

I am writing a script that attaches to several of our machines via SSH to check some usage stats. Each time I do: ssh -i ~/.ssh/ourkeyfile.pem user@host I get the typical message: Address ...
0
votes
0answers
25 views

Running command from script won't give desired output

If I run sudo /usr/lib/update-notifier/apt-check -p &> ~/update-list.txt directly on terminal, I get the update-list.txt file with all the updates in it. But if I write the same command in a ...
1
vote
3answers
1k views

gpg-agent says agent exists, but gpg says agent doesn't exist?

I'm struggling with some issues while scripting gpg with bash on a Debian 6.0.6 box. I have a script that does a batch of operations and wants to make sure that a gpg-agent is available before it ...
2
votes
3answers
1k views

Upstart script vs. command-line: why this difference in behavior?

I'm trying to set up Tomcat to start with upstart. I find the following works: description "Tomcat Server" start on runlevel [2345] stop on runlevel [!2345] respawn respawn limit 10 5 ...
1
vote
4answers
382 views

run php script in the background

is there a way to launch a php script and let it run on the server until it finishes? I use this php5-cgi /var/www/script.php -q & connecting via putty. When I close it (the session) the ...
2
votes
2answers
1k views

While loop read multiple lines from a grep

I'm writing a script in AIX 5.3 that will loop through the output of a df and check each volume against another config file. If the volume appears in the config file, it will set a flag which is ...
0
votes
1answer
277 views

Shell script to parse ip:port from a text file

I get daily a text file with ip:port, one per line, example: 11.22.33.44:80 22.33.44.55:8080 33.44.55.66:7777 I would like to parse the first ip and port in two different variables, then write them ...
1
vote
4answers
141 views

Stripping “extra spaces” in du -sk for bash script?

I am trying to use du -sk to get the size of two folders dirsize_temp=`du -sk /folder/path/here` and then an if statement to compare the sizes. The only issue is that when you run the command, it ...
0
votes
3answers
147 views

In a shell script, perform different actions depending on the file on a another server (web accessible)

I've been having trouble with firewalls lately on a few different servers. And im wanting to create a script that will run once every hour or so, and check a file on an external server and execute the ...
2
votes
4answers
1k views

bash : “set -e” and check if a user exists make script exit

I am writing a script to install a program with Bash. I want to exit on error so I added set -e to the beginning of my script. I have to check if a user exists inside of my script. To do this I am ...
0
votes
1answer
59 views

Discerning which GNU screen window is being used in a shell script

Using a shell script, how can you tell if a screen is running using shell scripts? For example, using pseudocode: IF (screen.screenname.running == TRUE) or something like that.
0
votes
2answers
595 views

mkdir: cannot create directory `../abc/2011-11-23: No such file or directory

I have got a sftp script that downloads the archives , unzip it and then rename the files according to date and moves it to respective folder. I had to move the script from USB drive onto a separate ...
0
votes
1answer
137 views

How can I append IPs (a whole class C range) to a file using shell scripting? [closed]

How can I use shell scripting to append a range of IPs to a file?
2
votes
2answers
61 views

Moving files and folders except few

I made a terrible mistake while move sites of one server to another. We created virtualhosts in the new server using virtualmin. But while restoring files from old server to new server, I mistakenly ...
8
votes
2answers
7k views

Getting shell script to run as a daemon on CentOS?

EDIT: For some reason half of my post got truncated, not sure what happened. I will update soon and will post that it is updated here at the top. EDIT: I have updated the post again, sorry for the ...
4
votes
5answers
673 views

Bash: Execute piped lines from stdin

I haven't found a solution to this after some searching. I think the search terms are just too general. I'd like to know how to execute a number of lines (at the bash prompt) which are generated by ...
0
votes
2answers
178 views

how to manage dates in shell

emphasized textI have a file containing 14000 dates . I wrote a script to find the last 5 days , 26/03/2002:11:52:25 27/03/2002:11:52:25 29/03/2002:11:30:41 30/03/2002:11:30:41 26/03/2002:11:30:41 ...
0
votes
3answers
198 views

Shell script does not work with cron

I have this shell script at /usr/local/1.sh: #!/bin/sh wget -r -np --user=peter --password='123' ftp://67.225.87.95/ -p /test/ If I run it using # sh 1.sh the script executes ok and does what ...
3
votes
1answer
296 views

reconstructing shell session from a typescript

There is a bunch of tools like 'script', 'screen', 'ttyrec' which allow record content of shell sessions. By design these tool records everything displayed on pty, including control characters. ...
0
votes
1answer
656 views

How to write a shell script for OS X to log in to a remote server via SSH and execute commands

This seems simple enough... I'm trying to write a script that I can just double click on in OS X. The script is to login via SSH to a remote server, run a git commit and exit. When I copy/paste my ...
-2
votes
1answer
216 views

shell script doesn't run correctly in cron [closed]

I want to call a shell script I wrote from a cron. The shell script uses the program Linkchecker. If I run the shell script from the terminal it works just fine. However, when cron runs I get the ...
4
votes
5answers
919 views

Bash: Quotes getting stripped when a command is passed as argument to a function

I am trying to implement a dry run kind of mechanism for my script and facing the issue of quotes getting stripped off when a command is passed as an argument to a function and resulting in unexpected ...
0
votes
1answer
143 views

Ubuntu using screen to control a Java server

I have a shell script that makes a backup of my server files before starting it. However I wish it to instead of just running it open a new screen session and then start it from there. Once its ...
1
vote
2answers
1k views

Sending email after successful mysqldump

I've a script which will take backup of mysql db through mysqldump. I'd like add another option in this script to send an automatic email if the dump is successful or failure. Here's the script: ...
2
votes
5answers
1k views

How can I track growing directories?

I have a system that continually runs out of disk space. Im going to write a script that cleans up directories that grow larger. Usually these are log directories. Given the nature of the machine, i ...
1
vote
3answers
145 views

shell script $$ value

When I use these shell commands: [root@linux /tmp]# a=$$ [root@linux /tmp]# echo $a 3985 where does the value 3985 come from? And why?
2
votes
4answers
3k views

Logging to a file, prepending a timestamp to each line (Debian)

I am trying to log output from some shell scripts of mine to a file, and I want the timestamp prepended to each line. From what I understood, that's what logger(1) is for, but I don't want the output ...
1
vote
2answers
741 views

Linux - Scriptable email client?

I'm writing a simple UI for the visually impaired using a speech synthesizer. I've looked all over the internet for an email client which I can script to fit these purposes but to no avail. I believe ...
1
vote
4answers
178 views

Difference in behavior of reboot

I have 2 machines running linux. In one machine, the reboot command is an executable normally found in all linux distributions. In the second machine the reboot command is a shell script ...
2
votes
3answers
374 views

Shell script to block proftp failled attempt

I want to filter and block failed attempt to access my proftp server. Here is an example line from the /var/log/secure file: Jan 2 18:38:25 server1 proftpd[17847]: spy1.XYZ.com ...
6
votes
3answers
439 views

Run shell script on a command

I want to run a shell script when date -s <string> command is used. For example i want to log the command to the file /tmp/user.log by executing the following command in the shell script ...
2
votes
1answer
708 views

how to rotate console.log in every day…? [duplicate]

Possible Duplicate: Script to delete files older than 30days My hard disk suddenly became full and I searched around until I finally discovered that a "console.log.9" file buried in ...
0
votes
2answers
631 views

how to write a Script to stop jboss and rename the corresponding log file in redhat

i want to write a shell script to stop my currently running jboss applications(may more than one jboss running in one server) and rename the corresponding log files generated in the log ...
15
votes
4answers
13k views

What is “-bash: !”: event not found"

Try executing the following under a bash shell echo "Reboot your instance!" On my installation: root@domU-12-31-39-04-11-83:/usr/local/bin# bash --version GNU bash, version 4.1.5(1)-release ...
2
votes
1answer
669 views

Passwordless sftp upload commands not executed using a shell script

I have made the sftp password less using the ssh -t key_gen option and the prompt for password does not appear anymore but when I write the commands to be executed on the sftp session like the ...
2
votes
1answer
839 views

Mount EncFS volume on Mac OS X works from user account but fails with root using su

I'm trying to automatically mount an EncFS volume by using login/logout hook scripts on Mac OS X. The scripts are run as root and automatically run user defined hooks as the user logging in or out. ...
0
votes
5answers
1k views

Which characters if cat'd will mess up my terminal and make a ton of noise?

I've written a wrapper script that I alias to cat, called safecat, that protects me from accidentally catting binaries and getting a ton of screeching from my PC speaker. Right now it considers a file ...
0
votes
3answers
180 views

Construct my bash command to save me pain

OK, brief background. I accidently rm -rf my usb external hard drive. Right now I am using Photorec to recover the files. (I accidently deleted 800GB. Its my personal files. Mostly it was media, but I ...
2
votes
2answers
227 views

Looping through subdirectories

I need to go through subdirectories of a directory /home/userName/ and find the files whose names begin with SY101 and their extension is .csv and transfer those files to another server. My question ...
2
votes
3answers
1k views

Get maximum memory usage of linux executable

I need a shell script which will retrieve the maximum memory consumption of a linux executable. The executable may spawn child processes using significant amounts of RAM which should be included in ...
1
vote
1answer
376 views

shell script to iterate through text files and delete a string

I have a few hundred text files in one directory with lists of users: &usera &userb userc &userd note that some do not lead with the &. Also, in some files, the last line does not ...
0
votes
4answers
548 views

Encrypting shell script

We have a few shell scripts for backup/database dump purpose which have username/password info in them. Is there any way do this other than SHC which appears to be having some issues.
0
votes
2answers
569 views

linux shell rotating script (not a “log rotate” script)

I have a directory that I want to archive. A rotate archive. Never more than 8 files, and each file would have the date of archive in its name. Example: 1_2010_08_01_17h35m26s_archive.tar.bz2 ...
2
votes
4answers
109 views

simple statistical analysis from shell level

i'm looking for some handy program/script to which i can pump data via stdin and which can present me some basic statistics of input data. for instance - provided with set of values separated by new ...
1
vote
1answer
393 views

Authorized_keys not getting permissions or owner set correctly when run from bash script

With the following snippet of a script to add new users each user gets a public\private key pair automatically created, with the private key in their home directory for winscping out. The script works ...