0
votes
0answers
17 views

Odd behaviour with varnishlog and stream redirecting

I wrote a helper to debug varnish installation and have used it on both production and development server. The odd thing is, I encountered different behaviour even though the setup is nearly identical ...
1
vote
4answers
270 views

How to make a copy of /proc/xxxxx? [closed]

A users account have been hacked on one of my servers, where the hacker have started some spam binaries. Before I kill the processes would I like to make a copy of them, but when I tar czf ...
1
vote
1answer
44 views

Difference between “crontab -e” & editing crontab file manually? [duplicate]

I noticed some people use "crontab -l" to view cronjobs and "crontab -e" to edit them. However there are also times where people manually modify "/etc/crontab" to view/add/remove cronjobs. Both ...
2
votes
0answers
60 views

CentOS colors in php-cli applications [closed]

I'm managing a server with CentOS 6.5 x64 installed. In my Ubuntu server, when I run composer or Laravel's artisan php cli command, parameters are colorful. But this doesn't happen when I SSH into ...
1
vote
3answers
76 views

Any Linux tool to create a repo file?

SuSE's package manager zypper is able to create repository file in /etc/zypp/repos.d/. zypper -n rr myrepo zypper -n ar -f http://path/to/myrepo myrepo I'm looking for an equivalent tool do the ...
1
vote
3answers
104 views

Completely reset PostgreSQL to default?

Question Is there a way to completely reset a PostgreSQL installation on Linux, so it is in the same state as when I installed it? Idea I have considered rm -rf /var/lib/pgsql/* rm -rf ...
1
vote
2answers
170 views

permission denied in running script

I am running a script but there is an unusual warning: This is what happened in my console #whoami root #ls -l test.sh -rwxr-xr-x. 1 root root 1894 Feb 2 01:58 test.sh* #./test.sh -bash: ./test.sh: ...
0
votes
1answer
234 views

“Long service output” in Nagios gets chomped for some reason

According to this page the limit of $LONGSERVICEOUTPUT$ is 4kB, but in my case, it stops showing the rest of the output after 970 bytes of output (26 lines), where there multiple newlines no long ...
4
votes
2answers
320 views

How to handle IP's with manual failover?

I have two identical storage hosts where the master is the only one the users can access. If the master fails, then I want to manually change the DHCP address, so instead of master points to ...
0
votes
1answer
258 views

sh bash script ambiguous redirect pid of file using single quotes

I have the following new line in my .sh file su --session-command='$javaCommandLine & >>$serviceLogFile 2>&1 & echo \$! >$pidFile' $serviceUser || return 1 When I had it ...
-1
votes
2answers
61 views

Compare installed rpm packages with available?

I would like to find the vmware packages that I haven't installed from their repo. The problem is that the output of yum search vmware is not the same format at from rpm -qa|grep vmware. Question ...
1
vote
3answers
107 views

How to accurately check if package is installed in yum?

I keep getting answers like: yum list installed | grep bind or rpm -qa | grep bind But that is not accurate as I'm getting a list of few other bind packages like these: ...
0
votes
2answers
57 views

Copy files from path to path same structure for each user

How to copy files from source /backup/cpbackup/daily/a1/public_html/index.html /backup/cpbackup/daily/b2/public_html/index.html /backup/cpbackup/daily/c3/public_html/index.html ...
1
vote
0answers
365 views

Can't write to other users “you have write permission turned off”

For some reason I'm not able to write to other users on my system. [root@hostname ~]# write write: you have write permission turned off. [root@hostname ~]# mesg y [root@hostname ~]# mesg is y ...
0
votes
1answer
88 views

Git installation for a newer version fails on ./configure

I'm trying to upgrade my Git version to 1.8.3 on my fresh new CentOS 6.4 server(Cloud). I'm trying these instructions here because I will then install the Gitlab. I have used this document before ...
0
votes
1answer
43 views

Get last modification date on many SVN repos

I'm hosting svn server for my developers. From server I see all configured dirs with svn repos. I want to get last modification date on all of them(obout 30 different projects). I don't want to ...
2
votes
2answers
208 views

check if process is running, even under cron

I have a cron job that runs every minute, but if it finds data, might take many minutes to finish. I need to tell if another instance of the script is running from another. To make things even more ...
3
votes
1answer
161 views

inotify in bash script doesn't work with ldapadd command

I have written a bash script which detects if a .ldif file has been written into a directory and if written, executes an ldapadd command and then deletes that file. The scripts is as follows: ...
-1
votes
2answers
627 views

how do I install pdsh on centos 6? [closed]

I'm following a tutorial on how to configure a centos machine to be a node in a hadoop cluster for HortonWorks. I'm doing this on a virtual machine on VirtualBox. Sadly, since I am a linux beginner, ...
0
votes
4answers
327 views

Script runs on 50 servers. How can I ensure only one executes a particular step?

I have some work that needs to be done on 50+ servers. The first step is to checkout an updated version of some source code onto a shared directory (assume all have the shared drive mounted). The ...
0
votes
3answers
270 views

tail-pipe-awk script, fine on Centos but weird on Ubuntu

I wrote a script on CentOS and now I'm trying to run it on Ubuntu and it is behaving unexpectedly. Here's something like the script, which I run under bash: sudo tail -F ...
1
vote
2answers
357 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 ...
-2
votes
1answer
410 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. ...
1
vote
2answers
471 views

shell script in crontab, not all output being logged

I've got a simple shell script that runs a few LFTP commands and processes the files. When running straight from bash I get full output of those LFTP commands on screen. When running from crontab ...
6
votes
1answer
205 views

How to start netcat in listening mode from another host?

I have a script where I would like to start nc in listening mode on 10.10.10.11, but I would like to do it from 10.10.10.10, where I have this script ssh -n 10.10.10.11 nc -l 8023 | mbuffer -s 128k ...
1
vote
3answers
262 views

Possible to kill command after a timeout if not success?

I would like to use mbuffer to do ZFS replication with, but in order to do that, I have to start it in listening mode on the target host. That I would do from the master host by ssh 10.10.10.11 ...
0
votes
2answers
909 views

Good pratice to create script to start/stop/restart service?

I was wondering what is a good pratice to create a good script to start/stop/restart some service. I will try to make myself more clear, ok ? Nowadays, I do something like this: let's say I would like ...
11
votes
5answers
4k views

Log all commands run by admins on production servers

It is company policy for admins to login to the servers via a personal username, and then run sudo -i to become root. Upon running sudo -i, sudo will create an environmental variable called ...
-2
votes
2answers
62 views

cron job allowed commands

i can use this command in cron job cat /etc/passwd its send my an email about all users info how i can see allowed command? like cat ! can i use service httpd restart? ( i test it and i cant) ...
-2
votes
1answer
160 views

CentOS 6 | bash_profile giving errors? [closed]

I have a .bash_profile, and its giving me an error "Unexpected end of file" I have no clue whats wrong, here it is, # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ...
-1
votes
2answers
188 views

copy cron job from one domain to another on same server

I have just set up the .com of a domain that previous ran on .co.uk on the same server, I have copied all the files, ran through them using bash to change the domain anywhere it was referenced, same ...
0
votes
2answers
2k views

.bash_profile not being read

So I am using CentOS 6.3 a fresh install and I was trying to add things to my path for OpenMPI so I edited my .bash_profile file to read: FOO='test' export FOO # Add support for MPI ...
2
votes
1answer
80 views

How can I remove old log entries from a log file and archive them somewhere else in Linux?

CentOS 4.x I apologize in advance if this is not the appropriate place to ask this question. It pertains to a linux server / IT admin task. I've got a log file on an old CentOS 4.x server and I ...
16
votes
14answers
1k views

Reasons for missing IP info in `last` output on pts logins?

I have five CentOS 6 linux systems at work, and encountered a rather strange issue that only seems to happen with my userid across all the linux systems I have... This is an example of the problem ...
1
vote
2answers
107 views

How to run script from root as another user (with user PATH)

I would like to have these commands run as the ss user from root mkdir bin cp -r /opt/gitolite . gitolite/install -ln gitolite setup -pk ss.pub mkdir -p .gitolite/hooks/common ln -s /opt/pre-receive ...
4
votes
3answers
929 views

Possible to ignore the users shell in “su” command?

If I do su - -c 'mkdir bin' user1 then I get su: /usr/bin/ksh: No such file or directory because the users shell is set to ksh in /etc/passwd and ksh is not installed. Question How do I carry ...
1
vote
1answer
101 views

Script expression to get part of a string?

I'm using the bash shell in CentOS, version ... $ uname -a Linux mydomain.com 3.2.29-48.63.amzn1.x86_64 #1 SMP Sat Sep 15 01:43:12 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux In my shell script, I want ...
1
vote
2answers
84 views

How can I determine when a command was entered?

On a CentOS 5.x server, I'm troubleshooting an issue and need to determine when a service foo stop command was executed. The logs for the respective service don't indicate this. I only see the ...
0
votes
1answer
211 views

Get total file size of all specified folders recursively

I'm using svn on a project and I'm trying to see how much file space all of the .svn folders are taking up. If I do something like du -h | egrep ".*\.svn$" It will list all of the .svn folders and ...
4
votes
2answers
3k views

Answer “yes” to ssh-copy-id first time run by script?

The first time ssh-copy-id it will ask # ssh-copy-id -i .ssh/id_dsa.pub backup@example.com The authenticity of host 'example.com (xxx.xxx.xxx.xxx)' can't be established. RSA key fingerprint is ...
10
votes
3answers
5k views

Edit a file via bash script

I am a beginner in bash scripting.I want to create a bash script to install install and configure stuffs on my linux box in an automated way. Suppose i want to edit /etc/yum.repos.d/epel.repo by ...
0
votes
3answers
598 views

How can I grep for two values from the same input being piped to it?

CentOS 5.x I'm trying to build a shell script that searches data provided via stdin. Here's an example of the input stream: Date: 1/1/11 Time: 12:00 AM Foo: 12345 Foo1: dskjflsdkjflksdjlfds ...
3
votes
1answer
1k views

How can I upgrade bash to >= 4.1 on CentOS 5.5?

I have a CentOS 5.5 VPS server. I want to use RVM. According to the console output when I run the RVM installer, RVM requires bash >= 4.1. I just ran yum update. My bash version is now 3.2.25. If ...
1
vote
2answers
716 views

copy cron jobs from one server to another server - using bash prefereable

I have recently done a migration from on dedicated centos server to another dedicated centos server. There were few backup cron jobs was runing on my old server. I would like to copy them to new ...
0
votes
1answer
172 views

bash command to get list of all hosted domains on centos server

How would I get list of all hosted domains on centos server using bash command. I am runing centos server. I need to fetch the list of hosted domains on that server. I can get it using plesk. but It ...
-1
votes
2answers
519 views

linux script - find java process and restart it if it is more than 80% Mem High

I want to put in crontab a shell script that will monitor the java process and if it's the memory is more than 80% then I want to restart it. can any one help? Thanks!! Elad.
2
votes
2answers
115 views

CentOS EPEL install, bitness-independent command

I'm writing a small 'install script' and it requires EPEL on CentOS. The command (repo url) differs according to OS bitness, how do I unify this into one command? References: How to install EPEL I ...
2
votes
2answers
524 views

Can I change the ownership of all the files of a specific user?

Is there a way to recursively find all files owned by a user and change them to another user/group in Gnu/Linux? I assume there must be some magic one liner but my command line wizardry skills are ...
2
votes
4answers
2k views

What command can I use to search sendmail logs for ALL message details involving a specific recipient.

CENTOS 5.x | Sendmail Occasionally I need to search through sendmail delivery logs to find out what happened to a missing message. This usually involves two (or more) steps: STEP 1: Search ...
0
votes
1answer
829 views

llinux - replace subnet mask in ifcfg-eth0 with sed or awk

I have 30 linux servers that I need to change subnetmask. I want to use a simple script or a simple command to change the subnemt mask from 255.255.255.128 to 255.255.255.0 in ifcfg-eth0. can ...