Programming in an Interpreted language executed by a running Shell

learn more… | top users | synonyms

0
votes
1answer
34 views

Issue with Bash Script On FreeBSD

I have the below bash script set to run every hour via cron as the root user. The purpose of this script is to email us when files have been uploaded to our sftp server and send us the logins. Here is ...
0
votes
1answer
26 views

How to automate input for a repetitive script! Expect in Bash?

I am a junior sys admin. Reason I'm asking this question is because we don't have a senior sys-admin here who is proficient with scripting. Senior guys are at the head office and too busy for ...
0
votes
1answer
43 views

Bash: Output of a command is written only to screen and not to another file while using tee, what could be the reason?

In order to troubleshoot some ftp connection error, I've been instructed to write a bash script which will infinitely connect to a remote frp server and get one file from there. ftpuser="ftpuser" ...
2
votes
0answers
21 views

Linux: What could be the reason for random fails in updating passwd.byuid by running yppasswd?

In order to allow NOC users in my company to manage users through NIS I've created the following script: #!/bin/bash # This script will simplicate NIS user management. # You will not be able to ...
0
votes
1answer
59 views

Executing command remotely on another linux server from a shell script

I have a shell-script which extract details from a log file between two dates and executes a command on the output to generate some report.The log files are on different server and scripts are ...
0
votes
0answers
26 views

How to package shell script file with license key file

I am working on automated shell script for specific task . Before executing task steps I want to validate the license key provided to the customer with a webservice call. Please help me in making ...
0
votes
0answers
7 views

rdesktop to a ec2 instance: why does not -s work?

I'm trying to connect to a windows ec2 instance and execute a script from linux shell. I'm able to start an rdp session with rdesktop (windows desktop opens on my pc), but no matter what command I try ...
0
votes
1answer
40 views

Command fails during script execution in bash

I'm working on a bash script for automatize some common tasks but I'm having some issues and I need some help. This is the script I'm talking about: #!/usr/bin/env bash PS3='Please enter your ...
0
votes
1answer
42 views

Creating enterprise init script (to support all Linux distros)

I'd like to create my own init script to make my program start at boot and be controlled via "service" utility in most popular Linux distributions. Requirements: it should be portable across ...
0
votes
3answers
66 views

How can a script loop for 30 days?

I have a script, backup.sh, that creates a backup of a MySQL database and then SCPs it to a remote server. This works great, and I can run this once per day using crontab with no problems. However, ...
2
votes
2answers
65 views

Looking for a way to wrap a command and give its own shell

I am working with the command line executing the same commands many times manually following the same pattern. Now I am looking for a way to simplify it by just typing the command only once. Lets ...
-3
votes
1answer
61 views

Are these Advanced Features possible with a Bash Script on an Ubuntu Server? [closed]

I am trying to build a really flexible and useful Server Backup Bash Script. I have pretty much no experience working or building Bash scripts. I know that thousands of them exist in the wild but I ...
-7
votes
1answer
57 views

Trying to understand linux script [closed]

I have this Linux script I found and I'm trying to understand it. Could someone please help me to understand it. The script if [ ! -d "/home/ftp/$PAM_USER" ]; then /bin/su - ftp -s /bin/sh -c ...
0
votes
2answers
33 views

Creating a log file inside a script works when manually run, but not when run through cron

I'm using Percona's Xtrabackup tools to back up a database nightly. I wrote a wrapper script to keep the proper number of backups around, write the output to a log file, and email the log file if the ...
0
votes
1answer
60 views

124 emails sent at once while one should be sent every five minutes by cron if a certain web service stops running

So I set up a simple script to send an email alert when a certain web service stops running. It has a simple flow of: test = $( curl [address] | grep [a certain string in response] | wc -l ) if [ ...
3
votes
1answer
200 views

How to schedule a Cron job for the second to the last day of each month

I want to schedule a task for the second to the last day of each month. I have read this great article about shell scripting the execution. I have also seen that you can use "L" to represent the last ...
0
votes
1answer
37 views

Why is permission denied during pssh?

I am trying to add an ssh public key to a bunch of servers authorized_keys file. My thought was to use pssh and a list of hosts. To test, I tried to pssh to one host: pssh -i -H root@host echo ...
-4
votes
2answers
44 views

What does this shell script mean? [closed]

#!/bin/bash /usr/sbin/ntpdate ntp.jst.mfeed.ad.jp I found such a script file,maybe it is used to confirm the time, can you explain it in detail?
1
vote
0answers
47 views

Running inotifywait on startup of machine

I want to start this inotifywait script on startup of the machine, in order to monitor the folders from the moment of booting: #!/bin/bash while inotifywait -r -e ...
4
votes
1answer
44 views

Script does not run under Domain Administrator

Server running 2003R2. I have a script, which basically sets a variable, which then uses it to name a backup file. I have given the exact script here: echo > "%temp%\tmp.vbs" wscript.echo 10000 ...
1
vote
1answer
51 views

SSH issues: keyfile and host file not working as expected

When I login to server with a key ssh -i /home/me/.ssh/id_rsa server everything goes without glitch. The key is authorized on the server. However if I try to do same from a shell script, I get a ...
-2
votes
1answer
145 views

How to insert text from a file into another in bash [closed]

The content in fileA is: Here’s the ip list. ip: 2.2.3.4 ip: 2.2.3.5 ip: 2.2.3.6 ip: 2.2.3.7 The content is fileB is ip: 1.2.3.4 ip: 1.2.3.5 ip: 1.2.3.6 ip: 1.2.3.7 How to use sed command or ...
0
votes
1answer
89 views

Executing local function code on a remote server

I am updating about 20 bash scripts that perform various server-side operational tasks, checking status / sending reports etc. On some environments these scripts will run locally, on others they need ...
0
votes
0answers
12 views

find running ec2 instances and compare with tag like “linux” running instances or get mail whose running without tag. vai shell script

with help of code: Array3=ec2-describe-instances | grep INSTANCE | grep running | awk '{print $2,$5,$9,$10}' Array2=ec2-describe-tags --filter "resource-type=instance" --filter "key=linux" | awk ...
1
vote
0answers
89 views

Powershell-Script is not exectued correctly

I have a power-shell-script which is called by a batch-file. The batch calls the script after it has set the execution policy to unrestricted. Currently the script does nothing more than writing a ...
1
vote
1answer
53 views

Mysql optimize one table in all databases

I see in the mysqlcheck manual that there's an option for --tables that overrides that databases option, but it isn't well explained. I'm trying to run mysqlcheck -o and I want it to optimize a ...
-1
votes
1answer
219 views

Bash Script - Expect does not send password that ends with $!. Also need improvement to report connection timed out

Update: Password issue is fixed and connection timed out message was fixed too. Adding \ before $! worked. Example: *password\$! set passwds { *password\$! @tempP@ss %Test4%} For connection timed ...
3
votes
3answers
152 views

How to pass command output as several arguments to another command

I have a command that produce a output like this: $./command1 word1 word2 word3 I want to pass this three words as arguments to another command like this: $ command2 word1 word2 word3 How to pass ...
1
vote
1answer
94 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
79 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 ...
0
votes
1answer
81 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
171 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 ...
1
vote
0answers
94 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
253 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
189 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
561 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
461 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
248 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
135 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
72 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
78 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
812 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
625 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
697 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
310 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
298 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
211 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
40 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
39 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
476 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 ...