Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
0answers
7 views

How do I automate this in a shell script? [migrated]

I'm using the application PlexConnect on my home server (a headless OSX box) and I have to ssh in (from an iMac) and manually kill the Python process sometimes with the following: ssh 192.168.0.7 ...
1
vote
1answer
50 views

Operator \> and \< (string version comparison) are not recognised in shell script

I am trying to run Casandra nodetool and getting warnings coming from .sh script. [root@d11ca4cc-fa95-c8a9-e133-e64c434f0e6f ~]# nodetool status /opt/local/share/cassandra/bin/nodetool[53]: .[97]: ...
0
votes
2answers
43 views

While loop does not return control

The following shell script works only for first server and does not loop to the next. I tried 0< before the ssh command but it still does not return to the shell script once connected. #!/bin/sh ...
-1
votes
0answers
24 views

Command to list all usernames on a Linux server [migrated]

What is the command that allows one to generate a list of all the usernames of authorised users on a Linux server? I have tried getent passwd | cut -d : -f 1 | xargs groups and less ...
0
votes
1answer
48 views

Cronjob for a bash script pauses for 2 minutes randomly

I have been running a bash script on CEntOS 5.5 machine that checks replication on a remote mysql server. The script creates a temporary lock file and is scheduled to run in Crontab every minute. But ...
0
votes
3answers
46 views

how to run the dialog command with proccess

Please look on my code – ( bash script ) I want to display both dialogs on the screen on the same time, one dialog display the: tail –f from - /var/log/proccess1.log , and the second dialog ...
0
votes
0answers
30 views

Bash and background processes PGID and receiving signals

My actual problem is that a process I run in an rcfile in docker as docker run container bash --rcfile rcfile remains attached to the bash session by sharing the PGID which means that when I Ctrl-C an ...
1
vote
2answers
100 views

Which open source program is similar to the Linux “dialog” command? [closed]

The linux dialog command is a great tool for creating dialog boxes in terminal windows (e.g. in a bash script). However, there is a drawback of dialog which is that the window is always positioned in ...
3
votes
1answer
68 views

How to view two dialog boxes on the linux console, running on the same time?

I want to view on the Linux console two dialog windows on the same time. I want a window that views the progress BAR, and the a second tailbox that view the logs are running. The problem is that the ...
0
votes
2answers
86 views

Bash: Execute command from variable without eval

I have a problem with a script which should execute a curl command composed from the given arguments. It works if I use eval in the subshell, however, I would like to avoid that as it seems to be bad ...
-1
votes
2answers
111 views

Read mail from Postfix using shell script [closed]

I would like to be able to read incoming mail from a Postfix MTA using a shell script. The shell script should be able to retrieve the mail headers, subject, body, attachments, etc., then mark the ...
0
votes
1answer
88 views

unable to run the script in linux using plink

I'm unable to run a script in linux using plink.exe. I'm using my user x to login and script is under y user, which I need to sudo to y and run it. I was able to at command prompt manually but not ...
-1
votes
2answers
97 views

Delete all files except the newest of each day

I have dump directory that is filled at the rate of one file per 4 hours. I wish to keep all files for a week then delete all except the newest of each day. Bash is preferred though other solution ...
-2
votes
1answer
54 views

how to write a script to get ifInOctets and ifOutOctets? [closed]

Can any one help me with writing a script to get ifInOctets and ifOutOctets from a server 10.38.2.24 ? I need help
0
votes
1answer
57 views

Bash function hangs while command run perfectly without function

Following function hangs : ssh() { local RESULTS; RESULTS=$(ssh $USERNAME@$SERVER $SSH_COMMAND1); echo $RESULTS; } ssh; while if i run following commands they work fine : ...
0
votes
1answer
295 views

Passing variables in kickstart

I have a kickstart file that takes a hostname in the %pre section. I cannot seem to figure out how to get it two the first. As you see it sends the server information to another device which then ...
0
votes
1answer
219 views

ways to automatically fix line endings in shell scripts or files who break with ^M

Problem We regularly break our files lines endings and things stop working without us noticing. Bash complains about "invalid option" or ": command not found" as described here: ...
3
votes
3answers
465 views

Year Month day from file name in shell script

I hava file names like below adn_DF9D_20140515_0001.log adn_DF9D_20140515_0002.log adn_DF9D_20140515_0003.log adn_DF9D_20140515_0004.log adn_DF9D_20140515_0005.log adn_DF9D_20140515_0006.log ...
1
vote
1answer
126 views

Replacing LineFeed \x0a with SED

I have to delete lots of Linefeeds (Hex \x0a) in a logfile. I just have sed to solve the problem. It is a bit complicated I know.. Do you have idea how to solve the problem? Here is an example ...
0
votes
2answers
221 views

Moving files using sftp

I am trying to move files from one location to another on the remote server using sftp below: for i in a b c d do sftp $REMUSR <<EOM>>$OUT 2>&1 rename ...
0
votes
3answers
143 views

Bash script: compare paths issue

I'm working on the bash script that iterates over the list of files. I need to compare the paths to this files with the array containing the restricted paths. Inside the for loop I get a path to a ...
2
votes
1answer
37 views

Inspecting how $PATH gets created

Is it possible to "listen" to a variable's value during the start of a new shell? I have a script that checks for the $PATH variable in the typical places, but I'd like to try something different. ...
-2
votes
1answer
33 views

Ubuntu shell: Get tomorrow's weekday [closed]

I have a shell script for backups and I need the Weekday of tomorrow. $Today = $(date +%a) #$Tomorrow = ?
0
votes
3answers
219 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 ...
4
votes
1answer
398 views

Shell script: the child process do not terminate in linux

I have written a shell script to initiate three background process in the same time. In shell script I am trying to wait for all children to finish their job and then the parent job to terminate. But, ...
2
votes
1answer
418 views

Terminate remote process when backgrounded ssh session is terminated

So right now I have a bash script that runs a command on a remote machine using ssh. The machine running the bash script is a Linux machine and the remote machine is a Windows machine running cygwin. ...
1
vote
2answers
3k views

Cannot get Exchange PowerShell script to run under Scheduled Tasks

I have a PowerShell script that works when entered directly into the PowerShell. The PowerShell program is run with the shorcut: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ...
0
votes
2answers
301 views

Script for search string inside the file for every one hour

I need to write a script where the particular string(alphanumeric) should be searched inside the file with every hour for whole day. And the search should not contain the previous hour results. Time ...
2
votes
3answers
1k views

power shell error: Cannot bind parameter

when i am trying to execute the below PowerShell command, i got error . The command : *PS cert:\currentuser\authroot> gci | where subject -like "UTN"* The error is below : Where-Object : Cannot ...
0
votes
1answer
91 views

How do I write a script that compares folder/symbolic-link names from two diffrent folders?

I need help in writing a script to create symbolic links. Here is a script that I have been running on background. #!/bin/bash SOURCE="/home/$USER/www" DEST="/var/www" while true; do find $SOURCE ...
0
votes
2answers
80 views

redirect command executed along with output shell

I would like to redirect the command executed along with the output to a file. for example: #ls >ls_out.txt ls_out.txt should be something like : ls file1 fil2 Thanks!
-1
votes
2answers
106 views

Run a script on ssh login

I have a development env. with 4 users, I want to be able to log their time logged in since they are contractor working from home. I have NO idea how to do it, my sys admin left me this weekend and I ...
1
vote
1answer
93 views

Wrangling sed to find and reformat login date (or, how to kill idle mosh-server processes)

I have an old method of killing idle mosh-server processes, which doesn't work on my new VPS. Here's the old method, which I run in root's crontab to clean up mosh processes that have been idle for ...
0
votes
3answers
708 views

Global Redirection of port 80 to 443

I'd like to setup my linux box so that anything hitting port 80 would simply be told ask that of 443. I want it to be regardless of domain, IP or whatever specific details may exist. If it can be ...
0
votes
1answer
503 views

find directories in the current directory, older than 5 days and archive them

This is basic questions. I need to find folders in the current working directory(not recursively) and if they are older than 5 days archive them. zip or tar.gz is fine. I can find the folders with ...
1
vote
3answers
494 views

How to start Rails from a shell script on Debian?

I don't really have any need to mess with passenger or capistrano at the moment. I simply want to run rails on boot on port 3000. I've attempted to replicate this tutorial for node as much as I could ...
0
votes
2answers
67 views

Script to change MySQL password from command line

I host some websites for people with a simple server. I can't afford nifty things like cpanel, and I don't want to waste memory on a giant blob of perl like webmin. I am wondering if anyone has come ...
1
vote
3answers
1k views

Running ssh-agent from a shell script

I'm trying to create a shell script that, among other things, starts up ssh-agent and adds a private key to the agent. Example: #!/bin/bash # ... ssh-agent $SHELL ssh-add /path/to/key # ... The ...
0
votes
1answer
177 views

using unison options in shell script?

I'm new to unison, and am trying to use its options in a simple shell script, but they seem to be ignored when the script is executed, causing no changes to be synced between the two servers. My ...
1
vote
2answers
626 views

How can I make ssh wait until the command exits? [closed]

I have a script that looks like this: SERVER="RHT372 RHTl373 RHT374 RHTl375" case $1 in "stop") for SERVER in $SERVER do echo "================================================" echo ...
0
votes
1answer
139 views

Providing network drive access to a windows service

I have a windows service, which requires access to a network drive. As Windows Service does not perform interactive logon, it's not possible to use mapped drive from active directory user logon ...
0
votes
1answer
86 views

Parsing access.log squid proxy

I have logs files, access.log-*, and I need exclude the 'TCP-DENY' (or include only the 'TCP-MISS'). How I parsing, like grep command on linux, access.log file on windows? On linux it is work fine. ...
1
vote
0answers
95 views

error in killing tshark from shell script

I'm getting this error "* glibc detected * /usr/sbin/tshark: double free or corruption " while doing this, any idea why? #!/bin/bash trap 'my_exit; exit' SIGINT SIGQUIT count=0 /usr/sbin/tshark -i ...
1
vote
2answers
193 views

Adding sleep / delay between iptables blocks in shell script

On one server, we're trying to block any access for the country China. We wish to implement this with iptables rather than via .htaccess. The problem we're experiencing though, is that when adding ...
1
vote
2answers
1k views

Incrond running but not executing commands CentOS 6.4

I have copied this question over here from StackOverflow... I have installed incron from the EPEL repository (0.5.9) (before you ask; YES, I also tried downloading the source and compiling locally ...
1
vote
3answers
835 views

scp stuck when trying to copy files from Linux to windows

I use the following scp syntax in order to transfer allot of files from Linux red-hat 5 to windows machine ( under Temp directory ), Remarks: SSH server already installed on windows machine I use ...
0
votes
1answer
49 views

disallow file types (shell script wordpress security)

We recently got our servers into SVN which has been great, but this causes a lot of problems when using things like WP Filebase for CMS file management. It's also hard to keep the uploads folder ...
3
votes
4answers
328 views

Bash one-liner that shows a running countdown until a DNS update (TTL expiration)

I find myself frequently tasked with updating DNS records and needing to know exactly when the refresh will begin (a.k.a TTL expiration). I came up with this bash one-liner that gives me the output I ...
1
vote
0answers
49 views

Obtain the free_memory value in xen

I would like to know if there's an alternative to the command I am currently using to get the real free memory for the system (meaning memory that can be assigned to new domU) xm info | grep ...
-1
votes
2answers
140 views

Try the command multiple times [closed]

I need to execute a command and also check if it was successful. If there was an error, I should try again and the following code is working as expected. But what if I need to try the same command 3 ...