Questions tagged [sh]
65 questions
2
votes
1 answer
How to watch for arrivng files if inotifywait unavailable?
I have a directory that gets written to when other machines send files via FTP. I want to put something in place that notices when files arrive and if their file name contains a particular substring (like "jpg"), move the file to some other…

user1011471
- 179
- 1
- 8
2
votes
0 answers
Init script has permissions issues, but running with /bin/sh resolves them?
Can someone tell me what's going on here? As far as I knew, these ways of executing an init script are identical.
box:~# whoami
root
box:~# /etc/init.d/nginx restart
nginx: [emerg] open() "/var/run/nginx.pid" failed (13: Permission denied)
nginx:…

laughingbovine
- 171
- 6
2
votes
2 answers
how to remove ^m symbol
I need to compile Qt under Debian 64-bit. I downloaded sources but there is ^M symbol everywhere in every file in the end of lines and bash doesnt run configure script. How to remove it from all files in qt sources? Thanks.

Alexander
- 125
- 4
2
votes
3 answers
FreeBSD rc.d script doesn't work when starting up
I am trying to write a rc.d script to startup the fastcgi-mono-server4 on FreeBSD when the computer starts up - in order to run it with nginx.
The script works when I execute it while being logged in on the server - but when booting I get the…

kastermester
- 177
- 8
2
votes
2 answers
executing a sh script from the cron
I have a test.sh script
#!/bin/sh
php /home/v/file.php
sh /root/x/some.sh
when I execute the file as root from command line it works.
sh /home/v/test.sh
when I set it to crontab -e (is the root cron), is not working
* * * * * sh…

Elzo Valugi
- 387
- 2
- 4
- 15
2
votes
1 answer
Cron Permission Denied
good day,
I have a bash script in my home directory that works properly from the command line (file structure is default media temple DV. < noted for certain permission issues) but receive this error from cron: "/home/myFile.sh: line 2:…
user32372
1
vote
2 answers
Compromised CentOS 6.10 server
I am working on a compromised server. CentOS 6.10 with [kthreadd] taking up most of the CPU.
Old crontab deleted, and the following content put in place:
*/4 * * * * R=$(shuf -i 1-29 -n 1);sleep ${R:-0};BP=$(dirname "$(command -v…

parg0
- 11
- 1
1
vote
1 answer
Shell script prevent switching to other shell or escape from it
If in my automation script, I need to do something like install oh-my-zsh, I will have a .sh script like this:
#!/bin/sh
runuser -l user -c 'sh -c "$(curl -fsSL…

xendi
- 414
- 5
- 10
- 22
1
vote
0 answers
Why are psql commands in my script suddenly being killed by jenkins / hudson?
I have an existing jenkins job that kicks off a shell script to copy my prod environment into qa.
We added a lot of data to prod (gzip dump went from 2gig to 15gig) and all of the sudden my jenkins jobs started failing.
We are running postgres 9.5…

Ted
- 11
- 1
1
vote
1 answer
Set alias from sh script in ESXi 6
I have created a simple script to setup an alias on an ESXi 6.7 host:
#!/bin/sh
alias ll="ls -la"
echo "Profile done"
When I run the script I see the echo'd message on screen, but the alias is not set. But if I execute the alias command from a…

TSG
- 1,674
- 7
- 32
- 51
1
vote
1 answer
How to escape double quotes and exclamation mark in password?
I have the following code:
curl -s --insecure -H "Content-Type: application/json" -X POST -d "{\"username\":\"$1\",\"password\":\"$2\"}" http://apiurl
In the above curl command I want to escape the " and ! in the password.
I have modified the curl…

me24hour
- 11
- 2
1
vote
4 answers
After launching .sh script appearing 'must be connected to a terminal'
i have a short bash script which can run a file.
When im trying to start this by "x.sh start", there is appearing a warning 'must be connected to a terminal'. How to start this? I tried some configs of chmods.
This script is in /usr/local/bin
Im now…

aio
- 21
- 1
- 4
1
vote
0 answers
Hundreds of zombie sh processes spawn then die
I have a few Ubuntu Server 14.04.03 LTS boxes that will occasionally spawn hundreds of zombie sh processes. This process spike will be picked up by the monitoring system, and send an alert. I found out that the process spike was sh zombie procs by…

Dan
- 11
- 1
1
vote
2 answers
script to count the occurence of the particular string in the given time interval
We are trying to write a script "sendemail.sh" to count the number of occurrence of a particular string in a log file "SendEmail.log" within the given interval.
We have a log file. In that we are searching for a pattern "ReqInputMsgLog" and need to…

pruthvi
- 161
- 2
- 6
1
vote
1 answer
Multiple spaces in folders and files for rsync backup via /bin/bash /bin/sh
Need a one-time backup of two old messy Windows XP machines because of a company split. Using CentOS 6 x64 minimal install, i mounted some MS Windows NTFS harddrives installed locally via ntfs3g and over the LAN via smb. i need to self document…

rjt
- 578
- 6
- 26