Tagged Questions
0
votes
0answers
15 views
schroot auto-mounting doesnt works?
I've been reading about schroot and trying to understand the parts in various tutorials that mention about auto mounting. For example check the section (and the parts after it) "Basic schroot ...
-1
votes
0answers
8 views
Execute command with Jailkit
So I created a jail at /opt/jail using http://olivier.sessink.nl/jailkit/ - how can I execute a command inside the jail now and get the output as I can do with chroot ?
The simplest command I'd like ...
0
votes
0answers
33 views
BASH: launch background process and check when it ends [migrated]
How can I launch a process in background and check when it ends within a bash script?
My idea is a script like this:
launch backgroundprocess &
while [ Process is running ];do
echo "PROCESS ...
-1
votes
1answer
22 views
Determine which process owns an flock'ed file
I have a Bash script that runs in multiple processess concurrently. The relevant portion looks like this:
flock /var/lock/my_lock my_command
Given that /var/lock/my_lock exists, is there a way to ...
0
votes
1answer
87 views
Linux- Permission denied?
I'm installing Neo4j server as a linux service, but when I install it, I get the following message:
/sbin/insserv: Permission denied
What is this? What should I do? I'm running everything with ...
0
votes
2answers
45 views
Bash files with Github [closed]
I've never saved any of my bash scripts with an extension and I've just recently pushed a bash script to Github and realized that it's not properly highlighting the correct syntax such as: comments, ...
0
votes
1answer
34 views
Close a SSH Session when it suspend
I start a ssh session on a remote host and execute a script on the remote host. The Script is an update script that change the remote IP.
Now my local bash script hanging on the line with this ...
0
votes
1answer
37 views
How do I pass a multiline variable as a parameter to a function
Trying to capture and display the output of curl was driving me nuts. I finally found a workaround, but I don't understand why it is needed.
Here's a script that fails:
#!/bin/bash
function ...
0
votes
1answer
30 views
Get logged on user in init.d script
I have created an init.d script to control a process as a service, in RHEL 6.x. In the script, I am using /sbin/runuser to start the process as an unprivileged user. This part of the script is working ...
-2
votes
1answer
16 views
Zip with a parent folder [closed]
I am currently in a folder /tmp/foo, e.g.
/tmp/foo
/tmp/foo/a
/tmp/foo/b
and I want to zip all the files/directories under this folder with a virtual folder bar, so that when un-zipped, it will be ...
0
votes
1answer
44 views
Monitor tomcat logs for exception
I am planning to write a bash script and run it as a daemon in the background. The script will continuously monitor the tomcat server logs for any exception, error, etc.
When an exception occurs, it ...
0
votes
0answers
22 views
Watch goes blank on refresh [migrated]
I'm running the following command in watch. Works for the first one but subsequent ones go blank
watch diff <(pacman -Q) <(ssh kate "pacman -Q")
1
vote
1answer
33 views
How to not run /etc/profile.d/custom.sh during Secure FTP login
When I attempt to Secure FTP (using WinSCP) to my CentOS 6.4 box I'm prompted with a message that states:
Received too large (168438314 B) SFTP packet. Max supported packet size is 1024000 B.
This ...
0
votes
0answers
38 views
Colorize Bash Console Color [migrated]
I need to be able to set my CentOS 6.4 bash prompt color to yellow.
I've managed to find where to set this (.bashrc) and the ANSI color for yellow (\e[0;33m).
I've setup my prompt as follows:
...
0
votes
0answers
32 views
How to turn off the beep only in bash tab-complete [migrated]
I find the beep useful for some things, so I only want to turn it off for tab completion (I'm not asking how to completely turn it off, that has already been answered). I also don't have root access, ...
2
votes
2answers
57 views
Can I use IPs assigned to virtual network interfaces in a bash script?
I'm wondering if it's possible to dynamically read in the IP addresses of network interfaces for use in a bash script. Something like:
#!/bin/bash
MYPUBLICIP= get_eth0_address
MYPRIVATEIP= ...
0
votes
2answers
36 views
Copy file to backup directory preserving folder structure
I have to copy a file in a directory, to its backup directory, preserving the folder structure.
Ex. The file aaa in MyFolder/Test/aaa to .MyFolder.bck/Test/aaa
I tried to use
cp --parents ...
0
votes
1answer
36 views
Pipe tail output via elinks
Consider the following command:
elinks -dump file.html
It will print the file, formatted as plain text (without HTML tags).
The file.html is constantly updated (a new data is appended) and I want ...
0
votes
1answer
76 views
> /dev/tty - What is the purpose of this command?
This is in one of the rc scripts in Red Hat and I want to understand the purpose of > /dev/tty[n]
last=0
for i in `LC_ALL=C grep '^[0-9].*respawn:/sbin/mingetty' /etc/inittab | sed 's/^.* ...
0
votes
2answers
96 views
chsh: PAM authentication failed
i want to change default shell env
and run chsh -s /bin/zsh as root user,
but a error message appeared: chsh: PAM authentication failed.
i find this thread ...
-1
votes
1answer
33 views
Trimming characters of a command in bash
I am running command in a bash shell as follows:
/usr/bin/ntlm_auth --request-nt-key --domain=TEST.DOMAIN --username=Administrator --password=mypassword
Although I would like to trim the last 6 ...
0
votes
1answer
41 views
Deleting Files in a Zip Archive on Linux
I have a situation where I need to be able to run a script and delete specific files within a zip archive. Below is the general setup
/mnt/directory
/mnt/directory/Folder1
...
15
votes
2answers
442 views
Is there a utility like cron, that schedules a job for later (but only once)?
I'm trying to design a program that sends a text when a certain (non-periodic) event occurs. Right now, I'd like a script that finds when this event occurs, and then schedules a (cron-like) job that ...
0
votes
1answer
56 views
Is it possible to change BIOS settings from Linux?
I'm trying to write a script to enable IPMI on a ton of machines without having to hook up a KVM to them one by one. Is it possible to change the BIOS settings from Linux? OS is SL6.
I understand ...
0
votes
2answers
29 views
get informations from x servers per ssh by bash script
I've server Master,SlaveA,SlaveB,SlaveC, and want to get eg. the space information from the server by executing one bash script on the master.
How can I do that?
--case--
192.168.1.1 - Master
...
1
vote
1answer
98 views
How do telnet-based programs report their terminal type to a socket server?
I've written a script called by tcpserver that heavily utilizes tput and similar commands. These commands need to know how to correctly write to the terminal and rely on the TERM variable to obtain ...
0
votes
2answers
81 views
Start Linux GUI app in a VNC or RDP session for later access
Using a BASH script, I need to launch a GUI application at boot in such a way that I can later connect via RDP or VNC and see the application running. For example, the script will run at boot and ...
0
votes
1answer
69 views
Bash: php comand not found when called from a script run with sudo
I have this weird problem. The php command is not found in one specific sitiation.
I try to call the command in three different ways. Only one of them fails:
Being user john I create a simple ...
1
vote
1answer
69 views
Linux RDesktop Lockups
I have a script I wrote to create RDP connections from Linux workstations to Windows servers. Everything is great when used on a machine plugged into an Ethernet jack but when used on a wireless ...
3
votes
2answers
69 views
How to filter out default system processes with ps?
Is there a way to get a list of running processes on a Linux system, minus the default ones running on every system (i.e. only the ones that were installed/executed after the fact).
Can this be ...
-1
votes
1answer
55 views
run expect script from other shell [closed]
my target is to create the /var/tmp/add_user.bash script by /var/tmp/create_script_add_user.bash script
and run the expect script ( add_user.bash ) from create_script_add_user.bash script
the ...
-1
votes
1answer
66 views
Run inotifywait in background
I tried literally ALL ways to get this script running in the background (as startup script, as daemon, etc.).
The problem is that this script works in the terminal, but not in the background:
...
1
vote
1answer
52 views
Bash, what does this redirect command do
I have a script that looks something like this:
ruby foo.rb > log.out 2> error.log < /dev/null &
In this case, i understand that STDOUT is redirecting to log.out and that 2> is ...
0
votes
2answers
76 views
Why need to use exec in upstart script?
I often see some upstart script has the to use exec, what is the point? Seems removing the exec the script also work?
e.g.
start on runlevel [2345]
stop on runlevel [06]
exec /path/to/program
2
votes
3answers
161 views
Added line to bashrc, now bash is not responding
I added the following line to the end of my ~/.bashrc (This is on a Linode box) and logged out of my ssh session.
source ~/.profile
Now when I log in, the shell is unresponsive. I never get to the ...
1
vote
2answers
149 views
Method to drop 50% packets of the total
On my machine I want that only 50% packets will receive.
I am working on centOS 5.5.
For that I searched on net. I got IPtables. I used random patch of IPtables.
Command
sudo iptables -A INPUT -p ...
0
votes
4answers
86 views
Linux utility to monitor for stupid / likely ill-advised commands
sudoing adds a little bit of a roadblock to doing potentially stupid and dangerous things in the Linux shell, but it is a meager deterrent to newer Linux users. Still, many users login as root or have ...
4
votes
3answers
108 views
Determine number of unique lines with awk or similar in bash
I am using AWK to read through a custom log file I have. The format is something like this:
[12:08:00 +0000] 192.168.2.3 98374 "CONNECT 192.168.2.4:8091 HTTP/1.0" 200
Right now, I have AWK (from ...
1
vote
1answer
63 views
How can I check if a domain points to me?
I'm writing some bash on a linux server, and there's one concept I'm trying to get my head around.
Given a domain name, can I tell if it's pointing to the current server? Bearing in mind that the ...
0
votes
2answers
89 views
re-create new link and remove the old link on one command
according to ln manual page:
man ln
-f, --force
remove existing destination files
so as I understand if I want to re-create new link to some destination directory/file
I can ...
1
vote
2answers
60 views
Strange behavior with `find -delete`
I'm using Ubuntu 12.04 with 2 x 2TB SATA3 harddisks in software RAID1. The filesystem is ext4 with data=writeback.
When using find . -maxdepth 1 -name '*' -delete to delete a large number of files in ...
-2
votes
1answer
226 views
Why ulimit shows different outputs? [closed]
I am very confused, and I tried a lot but I didn't get any way to overcome from a bug. I am posting the same. I am hoping that someone helps me.
My problem is,
When I run ulimit -n it shows 12000.
...
0
votes
3answers
103 views
How to set the ulimit (fd) when you fork a process?
Normally /etc/security/limits.h only work when you login into a shell.
How about when you fork a process in Linux, where is the value of Max open files of /proc/PID/limits is controlled by?
-2
votes
1answer
145 views
What's the best way to backup files via network on linux and solaris machines? [closed]
I wonder what the best way to backup files VIA network
I have Solaris machines with oracle 10i with VERITAS cluster , machines are connected to EMC storage
/data/oracle directory is mounted on the ...
0
votes
2answers
84 views
xargs remove file name containing $
I am using xargs to remove files from remote server.
xargs -a /var/log/del.log -i -exec ssh root@abc.com 'rm -rf "{}"'
del.log contains path of the files which are deleted on local server and I ...
-2
votes
1answer
50 views
case + how to implement equal or less or greater in case syntax
my target is to verify the range of number with (only with - case + esac ) , and print the range
so for example
if number is between 0-80 , case will print
>=0<=80
or if range is ...
0
votes
2answers
222 views
Linux command to find and delete certain files, but output the result or verbose mode?
So I use these command on my storage server to clean up some junk, but it doesn't produce any output or result. I found the syntax online somewhere and just modified for which files I need it. What ...
2
votes
1answer
154 views
Run multiple commands over SSH as sudo
I am trying to run commands as sudo over SSH, without success:
ssh -t -p 2222 name@server /usr/bin/sudo << EOF
chmod u-r /xy
chmod +x /xy
/xy
sleep 5
ps aux | grep xy
sleep 5
...
0
votes
2answers
88 views
special characters in http_proxy environment variable
What is the correct format using special characters in http_proxy environment variable?
Or to be mor specific, what to do with special characters in username or password when authenticate to http ...
0
votes
2answers
80 views
Bash logic to check memory and server load before launching a bacground process
I am trying to implement the following pseudo-algorithm:
while true
do
if there is 1G of free memory && server load below 60%
./some-script &
break
else
sleep 10
fi
done
...
