Script is series of instructions written in plain text file. The script interpreter (i.e. shell, Python, Ruby, etc.) can read this file and act on the instructions as if they were typed at the command prompt. The interpreter also provides a variety of useful programming features to make your scripts ...

learn more… | top users | synonyms (1)

0
votes
1answer
15 views

MySQL Crontab Check

I have a serverpilot.io server running from digitalocean (1gb Ram), MySQL will crash once a week, the stats say the server is using ~256 mb out of 1 gb, but mysql will crash saying out of memory.... ...
0
votes
1answer
21 views

Bash Script to search a webpage

I've Googled my problem, and it's getting more confusing. I want to write a bash script that will search this page for a specific string and echo if it's found. For example, if I wanted to search ...
1
vote
0answers
12 views

Automatically switch to Singstar Microphones when they're plugged in

I am running a media computer for my sharehouse and since singstar has been so popular I want to run Ultrastar for everyone too. The problem is that getting the microphones set up can be finicky and ...
0
votes
0answers
33 views

Script for Opening Two Terminals and Execute Three Consecutive Commands [duplicate]

I intent to open two terminals and execute three consecutive commands in bash script. Basically, the first terminal will execute first command, second terminal will execute second command, and back ...
1
vote
1answer
25 views

Turn cron job commands into executable script that can run manually

I was running my crontab that backups some folders, but since then, I have started the practice of shutting down my computer at night, so I find that they do not run...go figure right? :-) So my plan ...
0
votes
0answers
34 views

What is wrong with my code so far? [on hold]

I'm attempting to make a DNA translation script in bash that will take an input file, iterate through the file, and convert every three characters into the proper protein code it corresponds to. Thus ...
1
vote
3answers
37 views

Remove whitespace from all array elements

I have a array called arrayvar . Which is being defined as arrayvar=( $(awk '/'"$vovar"'/,/}/ {gsub("'"$vovar"'"," "); gsub("}"," "); gsub("{"," ");gsub(","," ");print}' temp1 | tr -d '\n' | sed ...
11
votes
2answers
439 views

Non-sudo alternative to /usr/local/bin for common scripts

I'm used to putting common scripts in /usr/local/bin so that I can execute them from anywhere with the terminal. For example, I make a shell script named 1, make it executable with chmod +x 1 and put ...
0
votes
1answer
61 views

A bash script to show logged off users [on hold]

Please help me create a bash script to show logged off users. It's easy to know which users are logged into a PC, the problem is to see those who are not, I have some time looking online, without ...
0
votes
0answers
25 views

Using sed to remove all lines containing special characters , numbers, and spaces

So I'm fairly new to using shell--bash specifically--and I'm in the process of writing a script which will translate files containing DNA sequences into a more useful format. Unfortunately, many of ...
0
votes
2answers
47 views

create scatter plot

file (1. arg) will create (scatter plot) for n. column (x-axis, 2. arg) and m. column (y-axis, 3. arg) function is called myfun sourcefile 1 3 for scatter plot of 1. and 3. column from file ...
0
votes
2answers
20 views

appends n-th line from the file x at the end of the file y

I have been asked to write a command that appends the n-th line (MYN) from a file (x)to another file (y). Here's what I've done so far: MYN=4 hey=$(awk 'NR==$MYN' x) echo "$hey" >> y But why ...
2
votes
2answers
125 views

How do I write a Bash script for this scenario?

I have these files in the directory home/acs. TBBN027162G_38d8-2f08-0c40 TBBN027605G_38d8-2f08-1518 TBBN027941G_38d8-2f08-0d1c TBBN027923G_38d8-2f08-35e4 I want to read TBBN027162G as service_id ...
0
votes
1answer
25 views

Try to execute a script (adduser.sh) in root /$

I'm a new user to Linux and been practicing using creating/using scripts in bash. I found a script to add new users automatically but when I try to run the script in root, I keep getting the same ...
1
vote
2answers
34 views

Make echo ignore spaces?

I have a file called temp1 sCellEventTrap-03-27 TRAP-TYPE -- CAC Code: 01 ENTERPRISE compaq VARIABLES { scellNameDateTime, scellSWComponent, ...
0
votes
0answers
13 views

OpenVPN --up called scrip does not work properly

I use such command to run my OpenVPN connection (part of script): gw=`netstat -rn|grep UG|awk '{print $2}'` openvpn --config ./openvpn.ovpn --up "./up $gw" >/dev/null 2>/dev/null& So I ...
0
votes
1answer
20 views

Ubuntu terminal runs script files as packages? [on hold]

Hi Ubuntu newbie here. Previously I tried installing something which would allow me to open packages through the terminal. However, when I go to run script files through the terminal, instead it ...
3
votes
2answers
55 views

How to execute a custom script when Internet reconnects?

My Internet gets disconnected every now and then. I'd like to run a Bash script every time the Internet reconnects. The script is quite simple: #!/bin/bash mplayer /home/user/sound.mp3 It's placed ...
7
votes
1answer
98 views

How can I send commands to specific terminal windows?

I'd like to write a script for opening multiple programs (servers) simultanously in separate terminals - doesn't matter which one - and assign different commands to different terminals with commands ...
0
votes
1answer
39 views

Run Python script with root privileges (not from terminal)

How can I run a Python script which, upon execution, brings up a dialog prompting the user for his root password - so that the script is run as root, being able to make changes to files within the ...
0
votes
2answers
41 views

Ubuntu can't find my bash-script at /usr/bin/

On my first Xubuntu I successfully copied my script trans.sh to /usr/bin, made executable and after that I can run it in any position of terminal, but my second Xubuntu can't find my script in ...
0
votes
1answer
16 views

running command on remote host by ssh fails when running inside script

The Situation: My Computer runs on Kubuntu 14.04. I am Admin of a Students House with some Netgear-APs. The idea is to have a script rebooting them all by one script. (ssh-key isn't posible) The ...
1
vote
0answers
18 views

Problem running backup script at shutdown Ubuntu 14.04.2

I want to run a script at shutdown, and a far as I can tell I've followed the proper procedures. The script (close) is supposed to launch another script (gdrive) in a terminal which prompts me to sync ...
2
votes
2answers
23 views

Executing wmctrl from bash

After playing a little from the terminal with wmctrl, now comes the next step. Execute wmctrl from a bash script. I do achieve to execute wmctrl in a bash when it is completely alone. Example: ...
2
votes
1answer
26 views

Flush Terminal Buffer?

I have a (proprietary) program which I start with ./program -a asdf in the Terminal. When I do that, I can see all the output at the right time. However, when I want to use the programs' output in a ...
0
votes
1answer
18 views

Help creating crontab to help with Disk Space Management IE: Delete files over 1 week old [duplicate]

I need a script I can call in crontab that equates out to --- find all files < 1 week old | rm files. I use macrium reflect free edition to back up my windows machines to a samba share ...
-1
votes
2answers
46 views

using a sudo command without a password for a certain app

I'm using a python script to run docker, but docker requires sudo commands to run and it's bad practice to store the sudo password in the file or give the whole python script sudo rights, I've seen a ...
3
votes
2answers
306 views

Tee doesn't get whole output from the pipe

I have a script executing commands like: export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH;./some_app -i $INDEX | tee $LOG echo "Number of errors: $(grep "ERROR" $LOG | wc -l)" The problem is probably in ...
0
votes
0answers
9 views

Read windows registry remotely via WMI or simular

Does anyone know if it is possible to read windows registry information from within Ubuntu, I realise this is possible using the Offline registry editor, but I want to read the data from a remote ...
2
votes
1answer
30 views

Is it possible to cancel or clear a notification created by a bash script using notify-send?

So I wrote a little script that makes sure a certain user plugs in a laptop when he logs on (it disables if he doesn't). The script uses notify-send to tell him to plug it in. If he plugs it in, the ...
0
votes
2answers
15 views

cron job wont execute the script

I have the below script #!/bin/sh tail -fn1 /app/agile/agile931/agileDomain/servers/01mustgagl01.natusmed.natus.com-AgileServer/logs/agileDomain.log| \ while read line ; do echo "$line" | ...
0
votes
0answers
14 views

Psycopg2 can't commit to a local database [closed]

I've got a postgresql database on my local machine. I'm trying to write a python script, for use on many machines, that will query system information and then store it to a database, called ...
-1
votes
2answers
64 views

Help with script

#!/bin/bash a=`netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n | grep -v '1 ' | grep -v '2 ' | grep -v '3 ' | grep -v '1.1.1.1' | grep -v '1.2.2.2' | grep -v '127.0.0.1' | ...
1
vote
2answers
44 views

How to disown a chromium or chrome app on double click

I wrote a bash script to open an app (by double click) in my chromium. The code works but after opening the app when i close terminal the app also closes. I have searched through web and found out ...
0
votes
0answers
15 views

Where do I put Ubuntu server post install script files

Using the kickstart app, I can create a (I presume) bash script to run after the install finished in a chroot environment. If I have pre-writtren scripts and config files to copy over, can I include ...
0
votes
0answers
14 views

Install script as service running under speciffied user

I would like to install services into init.d folder in most standard way. Suppose I have script which should be run under specific user and starts the service (tomcat8 good example) ...
0
votes
0answers
12 views

How to run a script between login(entering password) and being logged on(showing desktop)?

Is there a way to execute a script when a specific user logs in; after they enter their password but before they are actually presented with the desktop? The script in question may lock the computer ...
0
votes
2answers
45 views

apt-get exits bash script after installing packages

I have read the answers in this post but it doesn't seem to work for my problem. I am executing a bash script via stdin from wget: wget -O - http://serverip/subfolder/script | sudo bash I've tried ...
0
votes
1answer
26 views

Using wget with Streamcloud and pages where you have to wait

I'm new to bash scripting and as I heard of "wget" I decided to write a script to download just the .mp4 file from a streamcloud (or whatever) link. I use it normally like: wget -q -O - ...
2
votes
1answer
34 views

How can I force a command to execute before an application starts running

I want to perform certain actions via a bash script before opening any application eg. firefox/ deluge/ VLC via GUI or CLI. The script should be executed only for certain applications and not for all. ...
0
votes
0answers
49 views

How to change MAC address “permanently”?

I am using Kubuntu 15.04. I was using macchanger eth0 -rto change my mac address. But there were two problems: Every time I disconnect and again connect to the network, the mac changes to the ...
0
votes
3answers
60 views

logout current user from script

I would like to create a script that: run some commands execute sudo su - [some other username] after I exit from [some other username] -> logout Example: test.sh echo "test script" sudo su ...
0
votes
1answer
24 views

How to pass a command with variables to at?

So, I'm making a bash script that's supposed to accept times and an extension from the user (through zenity) and schedule a call with sipcmd at the given time: extension=$(zenity --entry ...
3
votes
3answers
53 views

bash: populating array with elements containing spaces and special characters

I want to be able to populate elements of an an array with arbitrary strings, i.e. strings that may contain \ and spaces for instance. I wrote this : #!/bin/bash function populate_array () { if ...
0
votes
1answer
26 views

Run the script with screen

I write a script to run p2pool. I can not understand how to add a run through the "screen -dmS"? #! /bin/sh ### BEGIN INIT INFO # Provides: p2pool start # Required-Start: ...
0
votes
1answer
21 views

set -n not working in shell script when executing with source

this is the shell script.. #!/bin/bash set -n <<COMMENT1 tHIS IS A MULTILINE COMMENT MAN COMMENT1 <<COMMENT1 THII COMMENT1 : echo "this is ashok" echo "${LOGNAME}" when executing ...
0
votes
0answers
20 views

Script in /etc/network/if-up.d not executing when eth1 is on

I have a script in /etc/network/if-up.d . My intention is that script will execute automatically whenever my eth1 interface is up. But it is not happening. The script also have 755 permission level. ...
0
votes
0answers
32 views

I want to run a script on boot system Ubuntu 14.04 Server

I've done anything like this I made a symlink in /etc/init.d sudo ln -s /home/sts/erp-enterprise/bin/jleaf-apps /etc/init.d then I run the command $ sudo update-rc.d jleaf-apps enable then ...
-1
votes
1answer
35 views

I want to run a script to start the server automatically at system Ubuntu 14.04 Server

I've done anything like this I made a symlink in /etc/init.d: sudo ln -s /home/sts/erp-enterprise/bin/jleaf-apps /etc/init,d then I run the command: sudo update-rc.d jleaf-apps enable then appears: ...
2
votes
3answers
39 views

How to make a bash script execute when the battery on my laptop begins charging/discharging?

I have a conky setup that displays my battery level. The problem is, whenever I plug/unplug my laptop from the charger I need to run the conky-startup script to get it to display properly. I find this ...