The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
29 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
0answers
35 views

Append files with bash one-liner? [migrated]

Currently I use multiple lines to append content into a combined file, e.g. ./myprogram 1.txt > Out.txt # Overwrite for the 1st file ./myprogram 2.txt >> Out.txt ./myprogram 3.txt >> ...
-1
votes
2answers
64 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
30 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
35 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
88 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
104 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
252 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 ...
0
votes
0answers
28 views

Bash Script issue : Discrepancy in output when executed via cron [duplicate]

I have written a bash script that writes date and database size of a DB to a text file. The script is executed via cron every week. There is some discrepancy in the output that is being generated . I ...
1
vote
1answer
68 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
123 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
100 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
36 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
29 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
128 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
256 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
216 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
2k 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
151 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
572 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
86 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
69 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
73 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
78 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
304 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
242 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
369 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
64 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
2answers
620 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
112 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
366 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
91 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
73 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
82 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
177 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
614 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
46 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
274 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
44 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
121 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 ...
1
vote
1answer
54 views

Cronjobs putting archive in wrong directory

I am running a website on an Amazon ec2 instance running the default Debian linux. I set up a cronjob to copy the site files, take a database imprint, and zip them up. I want to keep the file ...
2
votes
1answer
75 views

Hold till last command completes its execution

I am developing a shell script which actually stops aws running instances in a particular region & start them again as a part of schedule maintenance. but as ec2-api tools are heavy, takes time to ...
-1
votes
2answers
904 views

Shell script :: Reading a column from file & store it in array [closed]

I am working on shell script where i want to store O/P of the command in array. I have a file containing rows & columns from where i want to extract 3rd column & store all values in a array. ...
1
vote
5answers
109 views

linux how to tell the process for a script?

I ran a script postData.sh, but when I do "ps -ef", I don't see the script in the list of programs running but I do see extra -bash processes running. How do I determine the pid so I can kill the ...
0
votes
1answer
180 views

Nagios: bash is missing

I'm monitoring NTP server with nagios and nrpe, at the nagios server, when I get the following error: Service Status UNKNOWN Status information I am missing an important component : bash The plugin ...
2
votes
1answer
102 views

How do I find the biggest files on multiple servers and sum up their size?

I am trying to find the biggest files in the /export/home directory and add up (sum) their sizes. Script: #!/bin/bash filename=hostnames > export_home.log while read -r -a line do ...
1
vote
1answer
210 views

Automatic provisioning of Windows server from a Linux client.

Our company builds a server-based C++ application, which can be installed by a Windows installer. I would like to be able to remotely log into a brand new Windows server, and install that C++ ...
1
vote
1answer
80 views

nice command - are other commands executed with script also niced?

A quick question about how nice works. Say if I have a script that runs in the crontab like so 0 4 * * * nice -n 19 /usr/local/admin/script.pl It is set to the lowest priority. This script will ...
-1
votes
1answer
147 views

Bulk BIND zones creation [closed]

How can I create zones for 50 domains on Ubuntu 12 VPS? I have webmin (which allows me to use BIND to create/ manage zones). I was able to figure out what gets created to add a zone successfully. But ...