New answers tagged

0

You could create a script like this: #!/bin/bash cd /home/sniper screen -S NameOfScreen -d -m 'php -f sniper.php > results.html' You would need to execute the script yourself the desired amount of times with bash script


0

The answer probably lies with the "nohup" command. Or you can simply add an ampersand (&) at the end of your command to send it to the background and maintain control of the CLI if your script takes a long time. which is why I guess you want to use Screen? Ampersands on the command line


1

Is this what you are trying to do? echo -n "Enter the source widget name [ENTER]: " read srcWidgetName echo -n "Enter the destination widget name [ENTER]: " read dstWidgetName find . -type f -name "$srcWidgetName*" | while read -r file; do mv "$file" "${file//$srcWidgetName/$dstWidgetName}" done


2

As fruglemonkey said 1 sec is a bad choice. Try at least 5 sec mean. It will help to have more consistent graph. Of course you can show both data ;-) I can't see anything wrong on your math. But I suggest you to track number of packet/s too. This metric is a lot of important to understand problems. Is not rare you have pps limit reached with low traffic on ...


0

Testing for the absence of users while connected via SSH is never going to indicate that there are no users because you are logged in when you run it. The simpler solution would be to do the shutdown in the same script doing the rsync. Adding something to the end similar to: while true; do [ -z "$(who)" ] && /sbin/poweroff done If the machine ...


1

@Iain is correct that this script is likely not doing what you need, however in general if you're looking to compare strings you're missing an equalsign, this would probably work better: if [ "$CHECK_SYSTEM" == "Product Name: VMware Virtual Platform" ] ; then See this excellent thread for more: ...


2

Use echo to inspect the $CHECK_SYSTEM string returned by your command, it is not what you think it is. You will need to further process it to remove some whitespace. You may find the virt-what command more useful if it is installed on the system e.g. # virt-what vmware or # virt-what kvm virt-what is a shell script so you can easily add a copy to ...


0

Solved with: nohup ./webservice > output.txt 2>&1 & This way, I can log the stdout and stderr to a file and avoid hanging the git post-receive hook.


2

I can suggest to put the go (and the exec ?) in backgroung with (go build ; exec ./webservice )& You will not be informed if there is a problem in your go program by git, so you will need a log Maybe a better solution will be to automatically kill the go program if it is too long with timeout.


0

I'm sure some will arrive here, and are just looking for an easy way to generate a unique ID for use in their scripts, and it doesn't need to be a true UUID. If so, you can just do: MYID="U$(date +%s)" echo $MYID will generate ids like the following based off the current system time: U1454423662


0

the test tool can check for this (from the man page): -t FD True if FD is opened on a terminal. So you can use for example: if [ -t 0 ] ; then echo stdin is a terminal ..... fi or if [ -t 1 ] ; then echo stdout is a terminal fi


0

You seem to be unaware that you can add >> log.txt after the first EOF. sshpass -p"$PASSWORD" ssh -t $USER@$HOST <<'EOF' >>log.txt echo "....1...." sudo ls 2>&1 : etc EOF You can put in the same commands in both variants (newline or semicolon separated) though proper quoting is slightly harder in the first case (not in the ...


1

directory/* is expanded by the shell first (normally bash). Running echo directory/* will echo all matching files, and bash will sort these matching elements lexicographically first, before passing them as arguments to echo, which then prints them. In the case of running ls directory/*, the directory/* is first expanded by the shell, and then presented as a ...


1

The order will be in lexicographic order (alphabetical order). It will be exactly the same as what you see if you type ls directory/* at a Bash shell prompt. If you want to sort by modification time, you can use ls -t. See man ls for other sorting options.


1

I found the answer after some trial and error: ssh www-data@$BOX "tail -n 1 /server/musicgraph/prod/logs/dao.log | awk -F\$'\\t' '{print \$1}'"


2

You need to set the PATH at the beginning of the script or use the full path to protractor. cron uses a default PATH while yours is likely modified by some rc file.


-1

I suggest to use Aria2. It's powerful downloader. aria2c http://google.com.tw


1

Firstly, your syntax is incorrect, since the right order should be: ipmitool [options...] <command> Moreover, in the parameter -H ipmi_hostname, the hostname here should be the domain name of IPMI interface IP address. It's quite odd to login via IPMI through its own IP to print out its IP(!), so I assume that you want to login via server's ...


0

After running the env command under my new user I noticed that: SHELL=/bin/sh If you run the useradd command with useradd -ms /bin/bash [USERNAME] then it should work as expected. -s allows you to modify the default shell.


0

I found working solution here: https://af-design.com/2009/07/07/loading-data-into-bash-variables/ if [ -f "$SETTINGS_FILE" ];then . "$SETTINGS_FILE" fi


2

Google says cron would be best for this, but I don't want it to be recurring. Forget about PRTG for anything but monitoring and notifications. It's true - cron jobs are recurring. However, all you need to do is write a simple wrapper script that gets run by cron at the top of each hour - this script would: Check if your program is running. If it is, ...


0

Your problem is that sudo only is accepted for the first part, the redirection in the file is not done with higher privileges. Also your "-u" is a little bit confusing. Do you missing the user there? And i don't know if the " and ' are used right, you might have to experoiment with that.. This might work for you: sudo bash -c 'echo -e ...


0

Here's a pure bash solution. This is a new and improved version of what chilladx posted: https://github.com/albfan/bash-ini-parser For a really easy to follow initial example: After you download this, just copy the files bash-ini-parser, and scripts/file.ini to the same directory, then create a client test script using the example I've provided below to ...


0

I still received errors. postfix/trivial-rewrite[4745]: warning: hash:/etc/postfix/transport lookup error for "*" They got fixed after running: postmap /etc/postfix/transport


4

I'm not a Linux guru, but I'm going to guess that you have to move MillionDollars to John first before you delete Cancer. mv /home/John/Cancer/MillionDollars /home/John/MillionDollars rm -r /home/John/Cancer/


0

Check your profiles, and the scripts they call, for one or both of the lines: set -o functrace > /dev/null 2>&1 shopt -s extdebug > /dev/null 2>&1 For instance, my version of this problem was instigated by iTerm2 in OSX, and its shell integration script. It all worked prior to the version of bash you mention, but now I get the two ...


2

if you cant cat raw device it looks like whole thing is not responding... but if you somehow manage to make it work: first and most important, dump whole usb stick to file, using ddrescue if neccesary, in case shit hits the fan Then use either testdisk or gpart to recover partition table, those programs guesses start of partiton based on filesystem headers ...



Top 50 recent answers are included