0
votes
3answers
105 views

Exclude with the find command [duplicate]

I need some help getting the find command to work right in a script working on. I need to be able to exclude some directories. Below I have what I'm doing as a work around. sudo find / ( -name ...
1
vote
1answer
43 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
vote
2answers
353 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
vote
1answer
119 views

Logging commands executed by remote shell scripts

I've noticed that when running a script that connects to a number of our servers (to essentially run batch commands) that the commands aren't logged in the user's .sh_history or .bash_history files. ...
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
2answers
181 views

Cron daemon's status check on production server

I have a script which need to be run as cron job. In the staging environment i could run the script as a cronjob. but in the production environment it is not working, so i checked whether cron ...
1
vote
3answers
123 views

Why is ``head`` hanging and not terminating?

I have a shell script that has to find the newest file on a remote host. I have this bit: ssh -q $HOSTNAME -t ls -t -1 /path/to/somewhere/ | head -n 1 It prints the first line, then waits and ...
2
votes
5answers
3k views

How can I make a startup script (linux) to load all of my programs (dameons) on startup?

For example, I need to have the following script be executed on startup service httpd start service mysqld start service sshd start service pure-ftpd start /usr/local/bin/noip2 start I do NOT want ...
1
vote
2answers
211 views

how to manage credentials/access to multiple ssh servers

I would like to make a script which can maintain multiple servers via SSH. I want to control the authentication/authorization in such a manner that authentication is done by gateway and any other ...
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 ...
2
votes
2answers
1k views

Why is this bash command not echoing into a variable and what can I do to improve?

I've got a bash script I'm working to improve, and have put on a great fix thanks to Dennis Williamson. Unfortunately, one of the lines no longer echoes into a variable I can manipulate, rather dumps ...
0
votes
3answers
457 views

Script to gather all the files ending in .log and create a tar.gz file

I'm currently using this script line to find all the log files from a given directory structure and copy them to another directy where I can easily compress them. find . -name "*.log" -exec cp \{\} ...
2
votes
1answer
93 views

Writing UNIX scripts that include “init”

I have an install script for the operating system that I'm setting up and, in part of the script, I need to install the graphics card drivers. In order to do this, I'm required to switch to runlevel 2 ...
2
votes
5answers
375 views

How to get the timezone of a system image?

I'd like to get the timezone of a system. Now some caveats... Im using Linux, and the target systems will be UNIX. I'll be using only system images, ie. not the live system, but the partitions will ...
0
votes
1answer
234 views

Script to replace user permissions?

I am moving resources from Mac and Unix boxes onto our windows storage server. I need to replicate permissions from Mac and Unix using the users active directory equivalent. So: File A On Location A ...
5
votes
3answers
322 views

Can I create and manipulate unix “screens” in a script?

I have a work environment on my Ubuntu laptop in which I want to use three different screens. Eg. in terminal, I usually write screen -S mywork run_server_1 then, ctrl-a c to create a second ...
0
votes
2answers
165 views

diff script command to mail

Is there a way to add a command to mail this if it finds any changes in the /newchanes.list. mail with an attachment(/changes) saying it found changes and if not then the subject line would say: no ...
1
vote
2answers
693 views

CRON job erratic behavior with Bourne shell script

I have the following script, that runs normally when I type the script name at the prompt (logscript): #!/bin/sh dvar=`date +"%m\/%d\/%y"` filedate=`date +%b%d%Y` echo DSS1 > ...
0
votes
2answers
2k views

SSH not redirecting stdout to local terminal

I have the following relevant lines in a csh script: #!/bin/csh -xv set dvar = `date +"^%m\/%d\/%y"` set filedate = `date +%b%d%Y` set grepstring = "grep "\"$dvar\"" </home/user/log/logfile" set ...
1
vote
3answers
1k views

Providing command line arguments for an executable through a shell script

Suppose I have an executable xyz that takes a variable number of command-line arguments, and a wrapper Korn shell script xyz.ksh. Is there an easy way to pass all of the shell script arguments as-is ...
2
votes
10answers
3k views

Scripting alternatives to Bash shell scripts

I have just migrated to a UNIX workstation. My memory of Bash shell scripts has faded since school and I find the syntax to be highly confusing. I am wondering what other scripting languages are ...
99
votes
3answers
33k views

What is the difference between double and single square brackets in bash?

I just wondered what exactly the difference between [[ $STRING != foo ]] and [ $STRING != foo ] is, apart from that the latter is posix-compliant, found in sh and the former is an extension ...
9
votes
5answers
1k views

Where do you normally keep your UNIX/Linux scripts?

There are numerous scripts that I have written for my server. Some of them are in my ~/scripts and some of them are in application directories. I am just wondering is there a directory that you would ...
0
votes
3answers
220 views

Basic Automation

I'm a newbie server administrator having recently purchased an account from Slicehost.com and using it to host a few personal sites, so I can learn more (I'm primarily a web developer). Years ago I ...