Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms (1)

0
votes
1answer
19 views

manipulate process over ssh by PID

Say there's a process (PID 1501) running on a server. the server has firefox open (as 1501).. from the remote computer, i want to send commands to PID 1501 (e.g. 1501 -new-tab ). How would I run that ...
1
vote
3answers
71 views

Bash script to start a process, grep a line, then kill it

I'm looking to get the version number of an app that doesn't have any kind of --version option. I'm looking for a bash script that will start the process (it runs until killed), grep it's version ...
0
votes
0answers
19 views

Running Hudson builds with a higher nice level

I want to run build jobs in Jenkins with minimal cpu usage. I've tried this: Created the directory "jenkinsJdk".Jenkins is configured to use this dir as JDK "testJdk". A sample job uses "testJdk" ...
2
votes
3answers
37 views

Run bash_profile in cron job

I had a problem that my cron script wasnt loading the environment variables so I added the following line: #!/bin/sh bash /root/.bash_profile This seems to have no effect and the path variables are ...
0
votes
1answer
36 views

bash script - nohup not displaying output on my terminal

I setup my start_java.sh script as follows: #!/bin/sh echo "starting process" nohup java XXX When I run: [root@box ~]# bash start_java.sh it prints starting process However if I run ...
3
votes
1answer
40 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 ...
0
votes
4answers
63 views

Strategy for gaining ssh access without setting up a router

I'm going to need to administrate someone's macbook pro remotely over ssh. Problem is, they'll be moving between networks so I can't just set up port forwarding on their router. What strategy could I ...
3
votes
4answers
276 views

Bash script is not working as cron job

I have the following shell script $cat capture.sh TIME=$(date +"%H-%M-%d-%m-%y") IP="203.208.198.29" PREFIX=$TIME$IP tshark -f "udp" -i eth0 -w /root/captures/$PREFIX.cap& pid=$! sleep 2m ...
0
votes
1answer
13 views

Directory replication in New server

Scenario is to replicate all the directories,sub-directories,files,symbolic links present in Linux development Server to Linux QA Server. Lot of unix users also to be created. Consider an unix ...
0
votes
1answer
43 views

Lock down Solaris Shell Changing for normal users

I have a few dozen Solaris(5.10) boxes. By default, they are using ksh as the shell. Only a few users have sudo privileges. The rest do not. I don't want my regular users changing to another shell. ...
4
votes
6answers
150 views

how to write a script that only acts on new log entries

I feel like this should be a simple thing but I am having a hard time figuring it out. I am trying to write a script that will monitor one of the apache log files and take some specific action. But ...
3
votes
2answers
88 views

Octal representation of file/folder permissions using awk?

We have various of machines here with all sorts of hardware and Operating Systems, most of them do regular tasks with bash that an agent executes. However it came to my attention that some Solaris ...
2
votes
3answers
72 views

How do I start a fresh apache error log?

I did something stupid about 1 million times in a PHP script so my apache error log is now 12 megs! Not exactly a good situation to be in for debugging. Under what conditions does the error.log get ...
2
votes
5answers
63 views

Remove path from find command output

I have a bash script for deploying code from a beta environment to a production environment but currently I have to add the list of files to a txt file manaully and sometime I miss some. Basically my ...
-3
votes
0answers
53 views

Enviroment variable empty

These two environment variables exist but this doesn't work. Any ideas? echo $PWD > $VIRTUAL_ENV/.project
0
votes
0answers
35 views

php5-fpm: bash script to check config before restart

I write a script to create new vhost on Nginx. That script creates Ningx vhost config file, vhost user and dirs, php-fpm pool file. At the end of the script, I would like to check if config is ok ...
1
vote
1answer
85 views

Grep and xargs: File name too log

I'm trying to delete all the files that do not start with __. This ls | grep -v "__" | xargs -0 rm Yields : File name too long. Any help? EDIT: ls | grep -v "__" | awk '{print("rm \42"$0"\42")}' ...
0
votes
0answers
32 views

scp in for loop for installing printers — connection refused

I could've sworn I was able to setup printers by: setup first host with lpadmin setup additional hosts with for loop: wherein stop cups copy printers.conf over start cups for host in ...
0
votes
1answer
25 views

rsync and bash command substitution

Trying to get a script to properly make use of variables. (The below examples are on the command line but I see the exact same behavior when inside a #!/bin/bash script. $ FLAGS='--rsh="ssh -2"' $ ...
3
votes
2answers
70 views

tar specific number of file

I have a directory with 27K files, I would like to tar them into multiple INDEPENDENT tar files, each will have 5000 files and the last one, will obviously have 2K (27K is not dividable by 5). What ...
0
votes
2answers
34 views

Difference between default new file and new directory permissions

My umask is 0022 When I create directory using mkdir mydir the permissions I get are drwxr-xr-x However when I create file touch file the permissions I get are -rw-r--r-- Why do directories ...
0
votes
2answers
43 views

CentOS: E-mail notification of failed ssh login attempts

Under CentOS, I need a script that will run every 10 minutes and e-mail me if there are any new failed ssh login attempts in /var/log/secure.
0
votes
0answers
58 views

ksh + print the last value from parameter ( as $_ in perl)

I need advice - how to print the same last value in ksh scripts without to print param argument for example in perl last value is $_ , but we not have this option in ksh script example - of ksh ...
0
votes
2answers
65 views

Why does “sudo su - X” require password, but “sudo -u X bash” doesn't?

I know "why" questions are dangerous :) I have sudo access on RHEL, and noticed this: su -u fred su - Password: (I don't know fred's password). sudo -u fred bash [fred] $ Is there a way to not ...
0
votes
1answer
28 views

Bash SVN Post Commit Hook

I have a working post-commit hook bash script that syncronises a Trac instance with the latest revision for an SVN commit. #!/bin/sh TRAC="/var/trac/" REPOS="$1" REV="$2" if [[ "$REPOS" = ...
3
votes
3answers
75 views

Prevent 'cd' remembering symbolic links traversed

Say you have directory ~/mytool that softlinks to /usr/local/mytool. Then cd mytool leaves your current directory as ~/mytool, which may cause scripts to behave incorrectly. Is there a way to avoid ...
7
votes
2answers
60 views

How to safeguard a shell script against running out of control?

I've recently had an experience of writing a shell script which crashed a server (and damaged a partition) by consuming all resources. It was hooked up to a cron job, and it seems it took longer to ...
-1
votes
0answers
17 views

Is CTRL+C incorrect to use to return to command line? [migrated]

When I'm using tail -f and I want to return to the shell, I always use CTRL+C. Or when I am typing a command and feel like aborting it and starting over, I simply CTRL+C to get back to an empty ...
0
votes
0answers
29 views

Amazon EC2 - If I have two servers in parallel, can I designate one to run a particular php script?

I'm going to try out amazon EC2 with a project I've been running on a server in my room. I have a php script that calls an executable. <?php ... exec(someExecuteabe); ...?> This executable ...
0
votes
1answer
42 views

linux + run script on other shell because script stuck - not return to linux prompt

In my Linux machine I have binary script (called transferNames.bin ) The problem is that when I run transferNames.bin with & script stuck and not returns to Linux prompt “#”, even if I wait 1 day ...
0
votes
1answer
137 views

Why does the $PATH of an ssh remote command differ from that of an interactive shell?

I have a user that has made no modifications to the $PATH in any dot-files: it is exactly the system default setting. From a login shell: $ ssh example.com user@example.com:~$ cat /tmp/hello.hs ...
1
vote
2answers
97 views

find files with invalid predicates

So, I'm trying to get all files older than 40 days. (hence the -mtime -40), but can't find because some files have invalid predicates. (Need to find all files whether in current or descendant. $ ...
0
votes
4answers
124 views

grep and tabs: no match

#cat sample 1 -1 2 2 2 2 2 1-1 3 I need to get all the lines that contains negative value, that is 1st line only. Values are tab-separated. First I tried # grep "\-1" sample 1 -1 2 2 ...
0
votes
1answer
49 views

SSH connection gives no prompt, unresponsive

I'm ssh'ing from my OSX laptop to an OSX server. It worked a couple of days ago. Now, when I try and connect, no text is output. My session (with -v option) looks like: ~ $ ssh myserver ... ...
1
vote
4answers
88 views

run script as user who has nologin shell

All I need to do is to run a specific script as a particual user who does have the nologin/false shell indicated in /etc/passwd. I would run the script as root and this should run as another user. ...
0
votes
0answers
27 views

Shell script kill background process on quit [migrated]

I have a script like this: #!/bin/sh exec ./cmd1& exec ./cmd2 If I kill the script only cmd2 is killed, cmd1 keeps running. Is it possible that both processes quit automatically?
0
votes
1answer
101 views

Is there a way to redirect the output of pv command to a file?

I need to redirect the output of pv command to a file so i get read it's progress from another process. Or is it any other way i could do that?
1
vote
1answer
95 views

Sending mail from command line if body not empty

I'd like to write a simple script that alerts me if a log changes. For this I'm using grep to find the lines I'm interested in. Right now it works like this: grep line /var/log/file | mail -s Log ...
2
votes
4answers
70 views

SSH not seeming to run in bash script called via web server

I have a simple shell script that: Makes a directory on the remote machine. Copies a .epub file to the remote machine's new directory. Runs kindlegen to convert the .epub to a .mobi. The remote ...
0
votes
1answer
52 views

Making ssh truly quiet

I'm half way through writing a nagios script and I've hit an annoyance with SSH. According to the man page: -q Quiet mode. Causes all warning and diagnostic messages to be ...
1
vote
2answers
158 views

Auto scaling AWS EC2 instnaces based on memory utilization

I am setting up auto scaling based on memory consumed by the particular instance. I went through the link posted at awsforums. I was able to set my metrics and using the bash script given and with the ...
0
votes
0answers
29 views

AWS_CLOUDWATCH_HOME is not set

Hi all I am trying to run a bash script which contains following instructions, I have added the bash script to the cron job, when I checked the log the log says, AWS_CLOUDWATCH_HOME is not set. I am ...
0
votes
4answers
58 views

“Command not found”-unable to run the bash script [closed]

Possible Duplicate: My cron tasks report command not found I am trying to run a bash script #!/bin/bash export AWS_CLOUDWATCH_URL=https://monitoring.amazonaws.com # get ec2 instance id ...
1
vote
1answer
51 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 ...
2
votes
2answers
96 views

How to remove invalid characters from filenames?

I have files with invalid characters like these 009_-_�%86ndringshåndtering.html It is a Æ where something have gone wrong in the filename. Is there a way to just remove all invalid characters? ...
1
vote
1answer
26 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 ...
0
votes
0answers
7 views

How to pass bash variables (passwords) to IRSSI config file? [migrated]

I'm using IRSSI and I wonder how can I pass my IRC channel's passwords to the IRSSI config file (~/.irssi/config) without writing them directly in the file. In Mutt I've an awk command that queries a ...
0
votes
2answers
100 views

How do I completely remove all references to couchdb from Ubuntu 11.10?

I have removed and purged couchdb from Ubuntu, but if I type "couchdb" in the shell at any point, the system still tries to start it up before crashing. I checked /usr/bin, and I still have references ...
2
votes
1answer
101 views

screen is not detached

I have a script and use the following command in it: screen -dmS name bash -c "ls -1 > out" What I am trying to achieve is to create a screen session, run a command and detach from it. The ...
5
votes
2answers
223 views

Who can delete a file?

I created a file, did chmod 000 to it and then changed the owner and group to root:root. I was still able to delete the file as the original creator of it (not root). Who has permissions to delete a ...

1 2 3 4 5 21