0
votes
1answer
28 views

crontab truncates file path

I try to run the following command: crontab -u root /root/iss/current/node/bin/installers/nl_brandless_selector_full_hd/nl_brandless_selector_full_hd_cron_file But I got an error like this: ...
-2
votes
1answer
33 views

Ubuntu Server running Plesk subversion command only accessible to root user

I have a VPS through myhosting.com the VPS is running Ubuntu 12.04.5 LTS with Plesk 12.x when I log into my VPS with the root user and do svn help I get the standard reply telling me the basics of the ...
-6
votes
1answer
57 views

Get rid of the ubuntu thing that suggests what packages you should install [closed]

I'm finding myself in the unfortunate place of using Ubuntu as a server OS and its tendency to suggest what packages I should install and how to install them when a program I enter in the shell isn't ...
3
votes
1answer
44 views

a2ensite through shell script

I created a small script to add websites on my server and it looks like this: #!/bin/bash echo "<VirtualHost *:80> ServerAdmin admin@example.com ServerName $1 ServerAlias www.$1 ...
0
votes
1answer
36 views

Bash function hangs while command run perfectly without function

Following function hangs : ssh() { local RESULTS; RESULTS=$(ssh $USERNAME@$SERVER $SSH_COMMAND1); echo $RESULTS; } ssh; while if i run following commands they work fine : ...
0
votes
0answers
39 views

pam_exec not working? cannot allocate 2 bytes?

I am trying to run a script during the login process using PAM and libpam_exec; I have added this line to the desired file under /etc/pam.d/: auth required pam_exec.so debug log=/var/log/debug ...
1
vote
3answers
65 views

locale-gen with purge does not work

I use the --purge option to remove existing locales before generating new one, but seems cannot remove existing locales? e.g. # locale-gen --purge en_US # locale -a C en_AG en_AU.utf8 en_BW.utf8 ...
1
vote
4answers
293 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
341 views

Start Unix screen, Run command, Detach

How can screen be used to start a new session and run a command within that session without killing that session? screen -S myScreenName runSomething I tried the above command and it says [screen ...
3
votes
2answers
173 views

How to parallelize the for loop while scp the files?

I am running my below shell script from machineA which is copying the files machineB and machineC into machineA. If the files are not there in machineB, then it should be there in machineC. The below ...
1
vote
3answers
121 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 ...
0
votes
2answers
822 views

ulimit -n not changing - values limits.conf has no effect

I am trying to raise the open file descriptor maximum for all users on an ubuntu machine. This question is somewhat of a follow up to this question. open file descriptor limits.conf setting ...
0
votes
1answer
317 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
341 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 ...
2
votes
3answers
164 views

How to parallelize the scp command?

I need to scp the files from machineB and machineC to machineA. I am running my below shell script from machineA. I have setup the ssh keys properly. If the files are not there in machineB, then it ...
0
votes
1answer
299 views

Is it possible to auto update php.ini via a bash script? [closed]

I'm trying to write an install script and i need to change the sendmail line in php.ini but I want to do this automatically at the moment I'm doing this manually: sudo nano ...
0
votes
1answer
222 views

Tomcat error checker using bash

Can someone shed me some light, point me in the right direction? I want to create a script in bash that will checks exceptions in the logs during the startup of Tomcat app. This script should be able ...
-1
votes
2answers
58 views

Better way to exec at a specific folder

It is possible to exec at the specific folder, rather than I need to use two commands separately? e.g. cd /opt/folderA exec .... cd /opt/folderB exec ....
0
votes
1answer
51 views

How to set multiple paths with update-alternatives

For example, the following command install java to /usr/bin/java update-alternatives --install /usr/bin/java java /opt/java7/bin/java 1 && update-alternatives --set java /opt/java7/bin/java ...
-1
votes
2answers
44 views

any native disk utilization command without need to install

is there any simple bash command to show current disk read/write usage without installing anything on the machine ? please note it's not to test the hdd read/write speed, it's to know the current ...
0
votes
2answers
230 views

Strip out the 'n' \ new line out of the echo to a file [closed]

I have a bash script that pulls a bit of text from an external MySQL database. Most of the times it are 4 lines, each one on his own line. This text (in total) has to be placed into a file. The script ...
-1
votes
1answer
128 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
2answers
68 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
3answers
307 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
352 views

Using 'source' command in bash scripts

I am writing a bash script to attempt to automate initial setup on Ubuntu, and I have run into an issue I do not understand. If I run the following code: sudo apt-get -y update && sudo ...
0
votes
2answers
230 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 ...
1
vote
2answers
211 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
0
votes
2answers
421 views

AWS-CLI - Can't find my config even through it exists

I installed Amazon Command Line Tools (AWS-CLI) using: pip install awscli It installed successfully. I then created a file in this location: /opt/aws/aws_cred.txt [default] aws_access_key_id = XYZ ...
0
votes
3answers
1k views

Cant run rc.local manually and doesn't run automatically on ubuntu

This is quite a simple one. I created an rc.local file here: /etc/rc.local I made it executable. However, it doesn't run when I boot the server. I can see it in the directory and when I try to run ...
1
vote
2answers
73 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 ...
6
votes
1answer
241 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
284 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
1k 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 ...
0
votes
2answers
800 views

Output of /proc/diskstats in ubuntu

can anybody tell me about 11th field in /proc/diskstats? The documentation says that it is weighted # of milliseconds spent doing I/Os. Is it like # of milliseconds spent for DiskIO in a second? I ...
0
votes
3answers
83 views

Can't figure what's wrong with with my crontab

Due to some bug in one of my scripts i'm being forced to delete temp files every 30 minutes until i'll figure it out and debug it. To get it done i've written a small bash script that i run every 30 ...
1
vote
1answer
119 views

Setting “say” alias for espeak on Ubuntu Linux

I'm trying to make a compatible "say" command on Linux. So far this works: alias say='echo "$1" | espeak -s 120 2>/dev/null' I'm adding this to /etc/bash.bashrc. Problem is, this say is called ...
1
vote
1answer
166 views

Spanish Characters in Linux Server Bash Shell

I have a database that contains Spanish words in it. It contains words like sueño which have "special characters" in them. The MySQL database collation is set to utf-8-general-ci which supports ...
0
votes
1answer
172 views

Display menu instead of login prompt on Linux

After starting up a linux server (mostly Ubuntu or Debian based), I see a login prompt on the local console. To enable end users to restart such a server or start some maintenance tasks, I would ...
1
vote
2answers
110 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
1k 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 ...
0
votes
4answers
179 views

Sudoers file permissions

I'm trying to run the following command without the need for sudo: echo 1 | sudo tee -a /sys/block/$hd/device/delete The $hd variable changes dynamically from sdb -> sdi for each one of my HDD's in ...
2
votes
2answers
878 views

Add entire 300 GB filesystem to Git Annex repository?

By default, I get an error that I have too many open files from the process. If I lift the limit manually, I get an error that I'm out of memory. For whatever reason, it seems that Git Annex in its ...
0
votes
4answers
147 views

Assigning environment variables for CRON

I have a .sh script that creates a .tar.gz file and transfer's it to a remote server using RSA keys for authentication. The script will run from terminal but it will not when I try to set it up as a ...
3
votes
2answers
157 views

Rename a directory containing many files

I made a mistake in a rsync and all the files are copied long with its full path. All the files that I copied are at /var/www/photos/2012/1007/1007 Attempt 1 Now I would like to fix the paths, by ...
1
vote
2answers
709 views

Meaning of killall -0

I see from many place the follow command is used to check if a process exists, e.g. killall -0 nginx But from the documentation I can't see anything related to this argument, can anyone explain?
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 ...
4
votes
5answers
4k views

How do I split a string against a character in BASH?

I would like to be able to split an authorization code by the - character so that I can operate on each segment individually. I do not want to use external binaries (awk, grep) - this is to be as ...
0
votes
1answer
760 views

Where did start-stop-daemon store the pid file by default?

When I have a upstart script like.. exec start-stop-daemon --exec /tmp/test.sh --background --start I suppose will save the pid file somewhere and later use it for stop or restart, right? So ...
0
votes
1answer
43 views

SSH to last current location

Is there a way to make the default ssh location be the folder that was current when last logged out? I'm using bash and Ubuntu, so it looks like I could use the .bash_logout file to set a variable, ...
6
votes
1answer
3k views

Add server to known_hosts

I would like to add github.com to the known_hosts file from the command line as I am creating a puppet manifest to provision a remote server. I have tried: "ssh-keyscan -H github.com > ...