0
votes
1answer
14 views

How to get the pid of a process and invoke kill -9 on it in the shell script?

I have an application server which we start by running this below command and as soon as we run the below commnad, it will start my application server /opt/data/bin/test_start_stop.sh start And to ...
2
votes
2answers
73 views

login command not prompting for username/password

Under fedora-14 'login' command asks for username and password. $login login: Password: but with recent versions (Fedora19) 'login' command is not prompt for username/password, it Just hangs. ...
0
votes
2answers
23 views

Permanent header in bash terminal

I'm working on a small server I want to put together (nothing big, an Android HDMI dongle, running Debian armhf, no desktop, just remote), and I want a small little feature I've seen at a few places ...
2
votes
2answers
29 views

List of subdirectories that contains a particular file name

I am wondering if i can do this in a single shell command. I am in home directory and want to find a list of subdirectories that contains a particular file. The file name and the depth is always ...
0
votes
1answer
19 views

Disabling a keyboard key in console

I wrote a script that dialog command is vulnerable to Esc key, now I want to disable Esc key in console. NOTE: X11 has been not installed in server and xev or xmodmap doesn't work.
0
votes
1answer
23 views

Permission denied while getting the md5sum of a file using shell script?

I am running my below shell script which gets the md5sum of a files in my PRIMARY directory #!/bin/bash export PRIMARY=/data01/primary for entry in "$PRIMARY"/* do local_md5sum=/usr/bin/md5sum ...
2
votes
2answers
41 views

How to run the dialog command with proccess?

NOTE: Please look at my code, it's a Bash script. I want to display both dialogs on the screen at the same time, one dialog displays this: tail ā€“f from - /var/log/proccess1.log and the second ...
0
votes
0answers
24 views

how to insert seperate lines ( elemnts ) in parameter [closed]

I have the following csv file more file.csv 1,yes,yes,customer1 2,no,yes,customer5 3,yes,yes,customer11 4,no,no,customer14 5,yes,no,customer15 6,yes,yes,customer21 7,no,yes,customer34 ...
1
vote
0answers
72 views

bash: /etc/bash.bashrc: Permission denied whenever I open a terminal

On Ubuntu 13.10, when I open a new terminal, I sometimes get the following output on the terminal: bash: /etc/bash.bashrc: Permission denied However, the permissions should be fine: >ls -l ...
6
votes
2answers
152 views

how to mount a range of drives in bash?

I use something like this to unmount a range of drives: umount /dev/sd[c-k]2 Is there any way to use same thing with mount? something like this: mount /dev/sd[c-k]2 /[c2-k2]
2
votes
2answers
39 views

How to make an infinitely executing command kill itself when certain conditions are met?

I'm running a command on command line which infinitely generates a certain data and I'm looking for a particular bit of data, so I used grep to find it. As soon as I get the data, I want the command ...
0
votes
1answer
48 views

How does sudo decide whether a command is only executable by sudoers with ALL rights?

I just wondered why on a Debian system with sudo installed a default user can execute ls but not ifconfig since the binaries do have the same rights: -rwxr-xr-x 1 root root 114032 Jan 26 2013 ...
1
vote
1answer
27 views

PID of process causing error

I have this script: #!/bin/bash # -> dump.$pid ulimit -c unlimited # trap ERR set -o errexit # also trap error in the middle of a pipe (1) # otherwise it will only trap the error on (2) set -o ...
5
votes
3answers
414 views

Why can't I `tail -f /proc/$pid/fd/1`?

I wrote a simple script which echo-es its PID: #/bin/bash while true; do echo $$; sleep 0.5; done I'm running said script (it says 3844 over and over) in one terminal and trying to tail ...
-1
votes
0answers
45 views

Become root after login via plink from Windows host

I m trying to connect to a linux server from Windows host via plink. I couldnt figure out how to become root after logon. I have to login with ordinary user first as I can't change config of the ...
0
votes
0answers
12 views

Determin if the currnet terminal has a dark or light theme [duplicate]

I have several (Bash) scripts that uses ASCII color codes. They look good on my dark themed terminal, however on my colleagues light themed terminal the colors I selected don't look that good. Is ...
0
votes
0answers
28 views

Can't access GPIOs when switching to systemd, but why?

I'm using this ARM AT91 Sam9x5ek Embedded Device, with my Linux Images made by a Buildroot. Usually my init-system is Busybox, now I changed it to systemd. Since then I can't access the GPIO anymore, ...
1
vote
3answers
88 views

Network statistics on linux

I am trying to write a small script to gather network statistics on my Linux system. Is there any way I can do this? What I'm after is live stats on current network throughput. I have done some ...
2
votes
0answers
26 views

Tmux log output [duplicate]

Im looking for a solution to an issue regarding tmux. One of my scripts ns2server stopped working recently when running start (using tmux) but not in debug mode (not using tmux). I found that using ...
0
votes
1answer
46 views

How to evaluate a variable length in shell script?

I want to write a shell script, in which it will call different command according to the variable length. But I didn't figure it out yet. My unwork script is here: for i in n5 n25 if ${#i} == 2; ...
0
votes
2answers
128 views

how to remove all double quotes from csv except specific field

I want to remove all double quotes from my csv but not the fourth field (because the four fields represent PATH of file) Please advice how to implement this by sed or awk or perl one liner , etc ...
3
votes
1answer
36 views

awk + gsub + how to work with all kind of characters

The following awk command target is remove spaces and unnecessary quotes from CSV file and only from single words between separators awk 'gsub(/("[ ]+|[ ...
0
votes
0answers
39 views

bash script loses readonly value after first time thru loop

I have a bash script which seems to lose the value of the readonly constant after the first time thru the for-in loop. For example: #!/bin/bash readonly DIR="./groups/" for output in "${array[@]}" do ...
2
votes
1answer
65 views

Fetching Remote Windows System Information From Linux Server

I need a script/command that would fetch Windows System Information (Host Name,User Name, Domain, OS Info, Hardware Info, Memory Info, processor Info, etc) by running it on a Linux Server (RHEL 6.5 ...
3
votes
1answer
80 views

Is there a way to pass a variable from an awk statement to a bash function as an argument? [closed]

I am trying to look a for some specific values from (such as 1 or 4 and 2 or 3) a text file using an awk statement in a bash script. If this value is found in the file (within the awk statement), then ...
5
votes
1answer
78 views

Linux: $SSH_CONNECTION is set even without SSHing to the server

I have a remote server and I am writing a script in the server and want it to fire only when I SSH. I thought of using the $SSH_CONNECTION and $SSH_TTY for this purpose. I found out that when I have ...
4
votes
1answer
115 views

PS: what does “ps -o comm= -p $PPID” do

I have a script which does ps -o comm= -p $PPID. The explanation says this gets the parent process name. From the man page I found out -o means user defined format, comm means command and -p means ...
-4
votes
2answers
66 views

How to print numbers horizontally? [duplicate]

I would like to print something as 5,4,3,2,1. This is my program, but it prints the numbers vertically. numbers=5 i=1 while [ "$i" -le "$numbers" ] do echo ā€œ$iā€ i=$(( $i + 1 )) done Do you have ...
3
votes
1answer
53 views

Openbox pipe-menu script error

This is the weirdest thing. The script works when run from the shell with no problems. When I run it as an Openbox pipe-menu I get the error "Invalid output from pipe-menu". After playing around with ...
2
votes
2answers
128 views

CSV file + set CSV parameters and values in bash script

I have the following CSV file: Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa 1000,"1 0 0 1",1002,1002,1003,1004,1005,"1 0 ...
0
votes
0answers
32 views

Calculate Total disk i/o by a single process [duplicate]

I am looking for some tool that will dump total disk I/O by a single process after it ends. So far my finding is :- iotop= It shows i/o per process in real time but does not give total after process ...
2
votes
1answer
83 views

Bash script and processes

I have created a bash script for use with a graphical bar in Linux, however the script seems to spawn too many processes. The script: #!/usr/bin/bash executable="/usr/local/bin/bar" monitor=${1:-0} ...
3
votes
4answers
222 views

How to cut everthing until a specific word / after a find in a script

Hello I try to get the output of files from today wich contains ERROR. I use this to find the files I want: find /home/user/logfilesError/ -maxdepth 1 -type f -name "gandalf_*"\ -daystart -mtime ...
1
vote
1answer
49 views

Bash loop new user

I have to create 20 users on 10 servers. I want to create a script that will create 20 users for me on the server (that's easy with useradd) and encrypt the password. I have my variable $crypt=perl ...
5
votes
2answers
826 views

How to find out if httpd is running or not via command line?

I'm working on a small control panel for my server. I need a command that will say if httpd is running or stopped. Will probably be using the same code for other services as well.
0
votes
1answer
60 views

Is there a way of copying only directories and not files in bash? [closed]

I want to copy only directories from a folder on a remote server to my server. Is that possible? Here is the code I have so far but it copies files and folders: scp -rq ...
1
vote
1answer
39 views

copy mp3 to a target directory maintaining directory structure and deleting files when copy complete

Found this answer here for copying files and keeping directory structure. copy files find . -name '*.xxx' -exec cp -iv --parents -t /path/to/target_dir {} + Is there an easy way to maintain the ...
1
vote
2answers
188 views

Changing user to root when connected to a linux server and copying files

My script is coded in a way that doesn't allow you to connect to a server directly by root. This code basically copies files a server to my computer and it works but I don't have access to many files ...
5
votes
3answers
3k views

Prompt user to login as root when running a shell script

The problem I am getting is, when I enter the command, su - root at the beginning of my shell script file, it prompts the user to enter the password and then does NOT continue with the rest of the ...
0
votes
2answers
52 views

What are the specific naming conventions for variables in bash shell scripting language? [duplicate]

Is it the same convention as those used in known programming languages such as Java and C? I'm trying to create a lot of variables and I want it to start with a number, but I'm not sure if it's okay.
1
vote
4answers
111 views

How to set the process won't be terminated when the terminal stops

[Edit] Make it simple. I invoked java xxx... on Machine A using putty to connect from Machine B. However I cannot reach Machine B. How can I connect Machine A from Machine C to set the running ...
3
votes
5answers
305 views

Listing directories based on size from largest to smallest on single line

I can use the following command to get a list of directories and their sizes and sort them from largest to smallest (in the example I renamed the directories to numbers to make this easier to ...
2
votes
0answers
670 views

How to use rsync with GNU parallel?

I am using scp to copy the files in parallel using GNU parallel with my below shell script and it is working fine. I am not sure how can I use rsync in place of scp in my below shell script. I am ...
2
votes
1answer
62 views

Trying to compare a variable that is multiline in a if comparison

Here is the current file I am running: #!/bin/ksh -x export BIN_DIR="../../env" . $BIN_DIR/vdenv.ksh success="DROP CREATE TABLE GRANT" $worker_dir/runsql.ksh ddl X X > chnl_avt_v1.log ...
1
vote
1answer
91 views

How to copy in two folders simultaneously using GNU parallel by spawning multiple threads?

I am trying to copy files from machineB and machineC into machineA as I am running my below shell script on machineA. If the files is not there in machineB then it should be there in machineC for ...
2
votes
3answers
1k views

How to launch two threads in bash shell script?

I am trying to copy files from machineB and machineC into machineA as I am running my below shell script on machineA. If the files is not there in machineB then it should be there in machineC for ...
0
votes
3answers
109 views

Applying different permissions to files vs. directories

Sunny answered the question above in this post, The answer was given as No need for scripts. // Directories: find . -type d -exec chmod XXX {} \; // Files: find . -type f -exec chmod ...
0
votes
2answers
219 views

Bad configuration option: ControlPersist while scp with control master?

I am using SCP with ControlMaster to copy the files but somehow I am getting this error back - command-line: line 0: Bad configuration option: ControlPersist command-line: line 0: Bad configuration ...
3
votes
2answers
136 views

Identify partition by mount point

How can we identify what partition a filesystem is mounted on in Linux when the partition is not directly referenced in df output? For example, our system's fdisk output is: Device Boot ...
1
vote
2answers
107 views

How to properly launch a program and make possible to redirect its running output (stdout and stderr) at a later stage?

The problem is quite simple: I find useful to have the possibility to switch on (and off) the output of some running program in each moment I need. To be more precise I want to be free to redirect ...