The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
311 views

Safely execute custom script parts as sudo

In /usr/local/bin I've the following script called sdown /usr/local/bin$ cat sdown #!/bin/bash if [ $# -lt 1 ]; then echo "no time set" else sudo shutdown -h $1 fi Permssions are 788: ...
3
votes
3answers
608 views

Email to run a bash script

I have a bash script to restart a service that runs every 3am to guarantee that the service isn't crashed when users require it. However, I need to provide a simpler way for my partner (that isn't ...
2
votes
2answers
162 views

awk + perl + get two arguments in to awk syntax

please advice what wrong with my awk syntax and how to fix it ( this syntax is in my ksh script ) and I run my script on linux machine my target is to get from the file.txt only the lines that ...
1
vote
1answer
94 views

tput command + bold specific strings in file

please advice how to bold the "Date & Time" numbers from the following file with tput command ( I have Solaris machine) for example I want to bold only the "24-09-2009 16:17:45" etc for all other ...
2
votes
2answers
683 views

Init script & the green [ OK ]

I am trying to install fast-cgi for nginx on an EC2 instance. I followed the steps explained here, but that is meant for Debian and does not work out of the box for a red-hat based system. I modified ...
0
votes
2answers
460 views

How do I add a line to a specific stanza in a config file?

My configuration file, server.conf, has the following format [general] setting1=sdfdsf setting2=asdfadsf [ssl] setting1=sadfsdf setting2=sdfadsfkljasdf How do I add an additional setting to the ...
0
votes
1answer
143 views

Monitor USB port without physically plugin hard drive

I have to design a program to monitor USB ports of a linux server to detect when an external hard drive is plugged in and removed. Now I have one confusion in my mind about it. I have my own VPS. so ...
-1
votes
1answer
133 views

How to I retain text case while using %h in mt-daapd's config file? [closed]

In my mt-daapd config file is the line name = %h which, if I understand correctly, when my hostname is aCoolHostname this will evaluate to name = acoolhostname in lowercase. How do I use the ...
2
votes
2answers
525 views

Can I change the ownership of all the files of a specific user?

Is there a way to recursively find all files owned by a user and change them to another user/group in Gnu/Linux? I assume there must be some magic one liner but my command line wizardry skills are ...
1
vote
1answer
436 views

Script Shrew VPN

I have the Shrew client installed in order to connect to a cisco VPN. (side note: anyconnect royally blows and I spent several hours trying to get it to work; I had shrew running within 2 minutes ...
1
vote
2answers
105 views

Can't pass path to shell script

I'm new to OSX, and don't use the commandline that often. I'm trying to use a script to do some automatic deployment, but when I execute the script it is looking for a directory. I tried: sh ...
1
vote
3answers
464 views

FreeBSD rc.d script doesn't work when starting up

I am trying to write a rc.d script to startup the fastcgi-mono-server4 on FreeBSD when the computer starts up - in order to run it with nginx. The script works when I execute it while being logged in ...
1
vote
5answers
146 views

write in all lines plus one

Can you help me with a unix script to get result like this in file: apple1 apple2 apple3 etc.. till 100 from a file apple.txt which contains only one word - apple. Thank you in advance!
4
votes
3answers
182 views

Detect fails in setup script

I wrote a setup script to install my prefered programs and settings after I got a new server. apt-get install git git clone http://me@myvimsetting.github.com .vim ln -s .vimrc .vim/vimrc ... But if ...
0
votes
1answer
395 views

rc.local is not executed on bootup ubuntu

Im on Ubuntu 10.04. I want to execute script on system boot. I added it to rc.local. If I execute rc.local manually it works fine. If I boot system in recovery mode(2nd string in boot menu) it ...
1
vote
2answers
449 views

How to untar a single file from an archive with randomly generated directory names?

I'm trying write a script that will download a tarball from github and extract a single file from it. However the top level directory inside the tarball has some random characters in it, which I ...
0
votes
2answers
713 views

MySql information_schema error - Lock Tables

I have written a quick shell script to take each backup of MySql database & that works good. I was using the same scripts for all mysql servers tool, I have installed it on ubuntu 10.04 server. ...
0
votes
1answer
52 views

process in the background

I have loop in shell script and it takes time process only a few files in the list. How do I push the process in the background and select the next file while the first file is still being processed? ...
4
votes
2answers
1k views

expect + how to identify if expect break because time out?

The target of the following simple expect script is to get the hostname name on the remote machine Sometimes expect script fail to perform ssh to $IP_ADDRESS ( because remote machine not active , etc ...
1
vote
4answers
199 views

A script that verifies that Apache (or any account) has proper permission to navigate to a directory

It seems that Apache needs at least read and execute permission to all the sub-directories of a path in order to serve the files in the directory. Does anyone have a script or one-liner that could ...
1
vote
3answers
123 views

Logging with timestamp

I am trying to prepend log entries with a timestamp, but the generated timestamps do not seem to change over time: #!/bin/sh NOW=$(date +"%Y-%m-%d %H:%M:%S") echo "$NOW Logging something" sleep 2 ...
4
votes
1answer
193 views

perl equivalent of sh -e

In /bin/sh and /bin/bash (and I guess a lot of other shells), starting scripts with #!/bin/sh -e (or executing set -e in someplace in the script) would cause the script to abort when any command line ...
1
vote
4answers
2k views

Silent and scripted install of CPAN and Perl modules?

I need to install CPAN and some Perl modules automatically in a Scientific Linux (RHEL) installation script. Unfortunately the specific modules I want (at least one of them) cannot be found as RPM:s ...
3
votes
2answers
2k views

expect script + expect miss the send string + delay issue

I write the active.ksh script (based on expect) in order to login automatically to some Solaris machine and execute the hostname command (login to virtual IP in order to verify which hostname is the ...
1
vote
1answer
2k views

How do you set a locale non-interactively on Debian/Ubuntu?

Usually, I run aptitude -y install locales then dpkg-reconfigure locales to set up locale. Now I want to put it into a shell script, how can I reliably do the following, automatically / ...
2
votes
2answers
185 views

Tomcat server getting restarted frequently

We have a script like below to monitor our server. During this code our server getting restarted. Can anyone please explain the meaning of below script? if [ -f $HOME/catalinamonitor ]; then echo ...
2
votes
1answer
2k views

Is it possible to set a timeout on openssl's s_client command?

I've got a script which uses openssl's s_client command to pull certificates for a big set of hosts. Some of these hosts will inevitably be unreachable because of a firewall. Is it possible to set ...
1
vote
1answer
174 views

How to verify application up or not?

I would like to write a script to check whethere the application is up or not using unix shell scripts. From googling I found a script wget -O /dev/null -q http://mysite.com, But not sure how this ...
1
vote
1answer
215 views

ssh + multiple ssh connection failed

I have 47 Linux client machines and one Solaris server machine (all Linux client machines are red-hat 5.1) all clients perform ssh connection to the server in order to verify if ...
1
vote
1answer
286 views

Linux shell script - Is it possible to capture the output of a command and use it in another command

So I want to automate the process of uploading a file to Rackspace. Here's what I need to do: First, I type: curl -D - \ -H "X-Auth-Key: 123456789abcdefghijk" \ -H "X-Auth-User: ...
3
votes
1answer
167 views

shell script (KSH) + set file to param & perform test between param and string

in my linux machine red-hat 5.1 - in ppp file - I have only the signature.pl string !!! remark - third application write the signature.pl string in to ppp file I set ppp file in $a param And ...
5
votes
3answers
1k views

“watch” command to notify on newly created files on linux

watch command to notify on newly created files on linux How to modify the below command to notify on creating a new file to /usr/local/mydir/ by linux user john ? watch -d 'ls -l /usr/local/mydir/ | ...
1
vote
2answers
2k views

How can I recursively delete old files and prune resulting empty directories?

We're using an AIX server to house thousands and thousands of little files in a nested directory structure. I'm trying to write a script that will recursively delete old files, and then delete the ...
0
votes
3answers
77 views

shell script + match MAJOR and CRITICAL strings from log file

I need to match lines that have MAJOR and CRITICAL strings that comes after the word ERROR:< any integer number > please advice how to do that with one awk or sed command? more HW_Log.txt ...
2
votes
1answer
383 views

Using Gentoo's `ebegin`, `eend` etc under Ubuntu

We're quite fond of the style of the ebegin, eend, eerror, eindent etc commands used by Portage and other tools on Gentoo. The green-yellow-red bullets and standard layout make for very quick spotting ...
0
votes
2answers
686 views

rsh for windows 7

I am looking for rsh client for windows 7. It should be GNU. I also can't run setup on that machine, so this file must be copied. Reasons: I had a windows XP batch file with rsh commands that ...
1
vote
2answers
145 views

Does it make sense to copy files in parallel to the same NFS mount?

Here's an example: ( cp /tmp/one /nfs/one ) & ( cp /tmp/two /nfs/two ) & ( cp /tmp/three /nfs/three ) & ( cp /tmp/four /nfs/four ) & ( cp /tmp/five /nfs/five ) & wait Against a ...
1
vote
1answer
105 views

shell script + add inside the script PATH for standard output

Usually if we want to redirect script output to file we simply do /etc/create_connection.sh > file.debug.txt Or /etc/create_connection.sh | tee –a file.debug.txt But What I want is ...
1
vote
1answer
57 views

Bash: checking uniqueness of filenames, and renaming or removing files

I'm working in CentOS with bash and I have files in a directory as follows: 16948.png 16948_thumb.png 16948-1_thumb.png 16949.png 16948_thumb.png 16949-1_thumb.png 16950-1.png ...
1
vote
2answers
804 views

Shell script to start mysql server if not already running

I have a shell scipt and at some point I want to check if mysql is running and start it if it's not. I'm trying the following, but not having any luck: set mysqlstatus = `sudo ...
0
votes
1answer
221 views

Running root script upon ssh'ing as a particular user, but not upon standard login

I would like to do the following : If I login as user ABC via the login screen, do nothing. However if I ssh as ABC, then I want to run a root script, without being prompted for roots password, and ...
0
votes
2answers
1k views

How to fetch lines between two strings using shell script?

How to fetch lines between two strings using shell script? For example I am having a file called file_text.txt as below. MEDIUMINT CREATE ( MAXVALUE MEDIUMBLOB MEDIUMINT MEDIUMTEXT MIDDLEINT ); ...
4
votes
3answers
817 views

Bash-Scripting - Munin Plugin don't work

i have written a munin-plugin to count the http-statuscodes of lighttpd. The script: #!/bin/bash ###################################### # Munin-Script: Lighttpd-Statuscodes # ...
0
votes
1answer
496 views

What version of ksh ships with AIX 5.3?

I'm writing a Korn shell script for a client, who will use it on AIX 5.3. For testing, I'm using version 93u-1 Debian Wheezy. Is this the same version as the one I'll find on AIX?
1
vote
3answers
739 views

Shell Script for Sending output or log via email

I want to know if it is possible to get my backup script output or any of its errors via email using google (or any other SMTP server). I don't want to install a mail server on my local machine. What ...
0
votes
2answers
1k views

How to determine the block device booted from in a shell script?

I'm crafting up a shell script (to be called by cron) that runs smartctl on the booted disk on a weekly basis. Is there a fairly universal way to determine what the boot block device is (IE - ...
0
votes
2answers
439 views

Shell script to change uid for user

I have a file (users_uid) with users and uid are two parameters as given below : assds 611 dsdsd 612 xyzx 613 rerer 614 These users exist in the machine. I want to change the ...
3
votes
4answers
2k views

From a shell script, how can I check whether a table in MySQL database exists or not?

I am trying to write a script which allows a user to select the what manipulation he needs to do on a table. I want to check if the table exists or not. If it exists I will continue the other things ...
0
votes
2answers
96 views

OS X Server script to archive (or empty) a users mailbox every morning

I have a requirement (SpamAssassin 'training') to archive (or delete) two user's (users are junkmail and notjunkmail) inboxes at a given time every day if there is anything in them. Can anyone help ...
0
votes
2answers
108 views

export command within shell script

When I use export command at command prompt, it works as expected. But it does not work from shell script. [root@server shantanu]# export myip=10 [root@server shantanu]# echo $myip 10 [root@server ...