Programming in an Interpreted language executed by a running Shell

learn more… | top users | synonyms

1
vote
1answer
30 views

ZFS Send Script works when run manually but not in Cron (Already tried common solutions)

Script on sending end is as follows: #!/bin/sh #Variables bigdata=vid-zfs-live/bigdata today=`gdate +%m-%d-%y` yesterday=`gdate -d'yesterday' +%m-%d-%y` #Actions zfs snapshot -r ...
2
votes
2answers
1k views

Shell script for docker ps -a | grep to find number of certain containers running

I want to write a script that is executed by my development build server that will remove any 'similar' docker containers before building and running a new container. Below is pseudo code for the ...
-1
votes
0answers
10 views

shell script to backup mysql db in remote location

i need to back up mysql db in remote location(another server) please give me a example. my script like this #!/bin/bash NOW=`date +"%Y-%m"`; BACKUPDIR="location/of/your/backup/dir/$NOW"; ### ...
0
votes
2answers
27 views

script with multiple (more then 100) select options

I've been burning my brains out before finally decided to ask it here. I'm new in linux/bash scripting. So there goes my question: I'm using this little script in order to block certain countries ...
0
votes
0answers
10 views

How to run menu options automatically in unix script [migrated]

I am new to UNIX and tried to create automation script as per my requirement but stuck up in the middle.please help on this. Requirement: directory /usr/ab/bc contains two menus as test ...
0
votes
1answer
1k views

Using curl with cookies

I hope someone can help me out on this one. I have been trying this for a while now, with all sorts of variations and cannot seem to get this to work. I am trying to script a way to log in to ...
-2
votes
1answer
32 views

Script to remove suspended accounts automatically from Linux server [closed]

I have Linux hosting server with centOS, which have WHM installed on it. To reduce the costing and mis-usage of Disk space i am creating a shell-script which automatically removes the suspended ...
0
votes
0answers
35 views

Ssh into a remote machine and execute a script using “expect”

I have a script named serverbounce.sh on server A. However, my Hudson home is on a server B. I want to execute my script serverbounce.sh on server A itself.For this performed the following: a. Created ...
-1
votes
1answer
24 views

env not working in FreeBSD cronjob [duplicate]

On my FreeBSD server, I have setup a cron script for backups using Duplicity. This script is as follows: #!/bin/sh export PASSPHRASE= export FTP_PASSWORD= keyid= remote= excludelist= ...
0
votes
1answer
42 views

Installing a software in multiple linux machines using shell scripting in one machine

I will login to one Linux instance using ssh - putty and my goal is to install a software (for ex: I need to download oracle and install it) on 5 Linux machines with one shell script when I run that ...
0
votes
1answer
24 views

Convert $no_proxy to gsettings ignore-hosts

In order to use Chrome in Ubuntu and have it respect some hosts in $no_proxy, I need to set those comma-separated values with gsettings set org.gnome.system.proxy ignore-hosts <no-proxy> where ...
0
votes
0answers
26 views

Crontab by hostname

My system is having 3 nodes and the cron scheduling is defined in one of these 3 nodes. So while checking with crontab -l at times I am getting proper cron listings at times I am not as the node ...
-1
votes
1answer
43 views

bash scripts work fine when I run it from command line but not from cron [duplicate]

I have this bash script in runtests.sh file #!/bin/bash cd /Library/WebServer/Documents/protractor_clipboards protractor testscript.js When I do this on terminal ./runtests.sh But when I try to ...
4
votes
2answers
127 views

How do I programmatically convert putty logs to human-readable, searchable files?

Background: I have a Windows 7 workstation and use PuTTY for SSH connectivity to Linux servers with session logging enabled. I previously used the Printable output option but that has the benefit of ...
3
votes
4answers
11k views

control a bash script with variables from an external file

I would like to control a bash script like this: #!/bin/sh USER1=_parsefromfile_ HOST1=_parsefromfile_ PW1=_parsefromfile_ USER2=_parsefromfile_ HOST2=_parsefromfile_ PW2=_parsefromfile_ imapsync \ ...
0
votes
0answers
7 views

WinZip Courier automatically zipping email attachments

I am trying to create a pre-configured MSI file for WinZip Courier 6 (latest version) within a CMD script (eventually deploying on SCCM). The main MSI property to turn off automatic zipping is ...
5
votes
1answer
5k 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 ...
2
votes
0answers
45 views

Analyzing squid3 access.log log files with a all-in-one shell script

I'm just going to write a shell script that me the essential functions such as SARG offers. Sort by URLs with most hits (Top100 in 10min out of 10k) Sum of status / error codes As well as sorting by ...
0
votes
0answers
31 views

how to execute bash script with args in parallel on all the remote server if the remote server in the from of pair

Please read carefully problem first and then give solution................... we are having 3 files in directory myscript.sh (the myscript.sh file contain many function and starts/stop to ...
2
votes
1answer
116 views

Vagrant provision : shell script install mariadb-server on Debian prompt error

I'm looking for provisioning a Debian 8.2 Virtualbox VM with MariaDB 10. I use the following : sudo export DEBIAN_FRONTEND=noninteractive sudo debconf-set-selections <<< "mariadb-server ...
2
votes
4answers
7k views

Command does not execute in crontab while command itself works just fine

I have this script from Colin Johnson on Github - https://github.com/colinbjohnson/aws-missing-tools/tree/master/ec2-automate-backup It seems great. I have modified it to send email to myself every ...
3
votes
7answers
6k 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
33 views

How to call ftp script from main script

I'm lookign for a way to create backups from several databases and send result files to server in Debian Linux 6 (Sqeeze) from crontab job There are databases named database1 .. database4 Backup from ...
1
vote
2answers
1k 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 ...
2
votes
1answer
26 views

How properly handle deletion of pid.file in service script

I'm trying to write service script for application. So I can control it like this: ./myscript.sh start|stop|status On startup pid.file with process id creates, and based on it I can check status ...
4
votes
2answers
5k views

Unix separate multiple commands which has '&' (execute in background) in the end

To separate regular commands in Unix is to put semicolon in the end like this: cd /path/to/file;./someExecutable; But it seems not working for commands like this: ./myProgram1 > /dev/null & ...
2
votes
1answer
30 views

Does script execution time cut into idle logout time with ssh?

On one of our Mac OS X servers, we have set the following in /etc/ssh_config: # Keep idle connections alive for 10 minutes Host * ServerAliveInterval 600 Two questions: 1) Is this a good way ...
0
votes
0answers
44 views

Querying RDWeb for /rdweb/pages/webfeed.aspx

Question: How can you pull /rdweb/pages/webfeed.aspx from a Server 2012 R2 TS through a shell script on a Linux system. Purpose: I wish to enhance usability of xfreerdp by having something like a ...
2
votes
2answers
2k views

password check in bash script calling on expect

Background: I have to copy a file from one server, to over 100 servers in a test environment. once the file is copied, it requires to have the permissions on the file changed/verified. These are all ...
0
votes
1answer
60 views

getting a list of live assets using nmap and script?

I'm playing around with a way to find all network assets from the command line that will return an IP, a hostname, and then have a way to see all interfaces associated with that host. I was using ...
0
votes
1answer
556 views

Can not seem to get expr substr to work

Can anyone tell me what I am doing wrong ? [ /jlr/sub/libexec/vmr-staging ] $ expr substr "onetwothree" 1 4 expr: syntax error I got the syntax from http://stackoverflow.com/a/220464/1150847
3
votes
1answer
61 views

Is there a way to Controle the IDRAC Console through scripts

is there a way to Controle the IDRAC Console through scripts, i.e. say if i am installing OS on Bare Metal Server and i only have IDRAC as a source and want to select the OPtion 1 or 2 or 3, instead ...
3
votes
0answers
38 views

OSX Terminal.app seems to become 'suspended' unless I VNC into the Mac

So I have a bit of complicated setup, but let me see if I can simplify I am running a mono application on a remote OSX machine. This application can occasionally hard-crash the mono runtime. There ...
9
votes
2answers
5k views

How to grant sudo rights only to specific script files?

I would like a user to have sudo rights (without password check) to a couple of shell scripts under a specific directory (in my case, /usr/local/tomcat7/bin), and to nowhere else. What's the simplest ...
2
votes
1answer
76 views

I need a command to create a unique fingerprint from unix machine

I need to create a serial number for my application in a Unix machine. The generated serial number should be unique Do not change over time (Only changes after hard drive or mother board changes) Do ...
0
votes
1answer
20 views

How to find the latest binlog of MariaDB by shell script?

I want to find the latest mysql binary log in /var/log/mysql/, but I found the name of binlog is mariadb-bin.0000*, and we also have mysql-bin.index, so it's really hard for me to use shell script to ...
2
votes
1answer
70 views

How can I use openssl to get results from HTTP GET requests?

I need to use openssl to perform some HTTP GET requests in a shell script. The line I'm using to do this right now is shown below. This is parsing the content of an XML response of the following ...
1
vote
1answer
115 views

Bash: How do I pass “command not found” text into my trap function?

I have the following: test.sh . Foo.sh Foo.bar Foo.baz Foo.blah and Foo.sh function Foo.bar() { echo 'I am a bar!' } function Foo.baz() { echo 'But, I am a baz!' } function ...
5
votes
3answers
5k 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 / ...
0
votes
1answer
79 views

How to create an AMI excluding all attached volumes for all instance within VPC using shell script

I have written script to find instance-id from VPC n create AMI of each instance-id : #!/bin/bash #Script to Automate AMI backup echo "----------------------------------\n `date` ...
5
votes
2answers
7k views

ssh fails to execute remote command when run from cron bash script - works from CLI

I have a script, written in bash, which runs from cron. One of the first things it does is SSH to a remote host and retrieve a list of files in a directory. Everything works fine when run from the ...
1
vote
2answers
211 views

Oracle Golden gate version using shell scrip

I am trying to grep the Oracle golden gate from a remote machine, But along with version it is giving some error details also, How do I resolve it ? user@serverhost:/dbei > echo <golgengate ...
0
votes
1answer
88 views

How to monitor the pid of each command in shell script? [duplicate]

In my situation, I have one shell script running rsync and tar in the background. Rsync is used to transfer files, and tar is doing compression after rsync is finished. My problem is how to monitor ...
5
votes
5answers
7k views

Connect to MySQL trough command line without need root password

I'm building a Bash script for some tasks. One of those tasks is create a MySQL DB from within the same bash script. What I'm doing right now is creating two vars: one for store user name and the ...
0
votes
2answers
145 views

What are the best ways to monitor and report disk usage on solaris?

df and du provides a total view of usage but the problem with these is that they are not broken down per user. Is there a tool that does this? I found quot but that only works on ufs. Is there an ...
2
votes
1answer
92 views

Echo each shell script command with a timestamp

set -x or set -v prints every executed command. How do I get the command printed with the time when the command started executing?
0
votes
3answers
115 views

Strange behavior of SCP through .sh file

I'm hitting a strange issue with SCP on cygwin, scp $HOME/deploy.sh user@host:/tmp works fine, files get copied to the remote system. But the same command inside a test.sh won't work. I can see ...
1
vote
0answers
11 views

Simple way of restarting crashed processes in server within 3 attempts if its exceed need to skip the script?

I have one file name hello.sh. I'm running that file at every 30 mins from crontab. In hello.sh, I have script for checking the service whether it is running or not. if its not running then it will ...
0
votes
0answers
261 views

Restart ffmpeg process streaming rtmp video if it fails using shell script

We use ffmpeg to forward streams live. Often due to unknown reasons or due to the stream stopping temporarily the command stops running in the background. What's the best way to monitor and continue ...
1
vote
1answer
128 views

subshell is not created if run commands without a path?

I'm reading the book "Linux Command Line and Shell Scripting Bible" 3rd edition. On page 279, here I quote: "Command substitution creates what's called a subshell to run the enclosed command. A ...