Whenever I run this code I always get the error "bash: screen: command not found"
The code's supposed to run spigot.jar, while also doing a few other things (not my code)
I really don't know what to try, but I do think I might have to be using linux (which would be a pain in the ass figuring I only have one computer)
screen -S powercraft/PRISON -p 0 -X stuff "`printf "stop\r"`" ;
screen -S root/PRISON -p 0 -X stuff "`printf "stop\r"`" ;
sleep 10 ;
pkill -f PRISON ;
cp -r /home/ALL/update/plugins-1.8/* plugins ;
cp -r auto/* plugins ;
sleep 1 ;
rm -rf auto/* ;
screen -d -m -S PRISON java -server -Xmx6G -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:MaxGCPauseMillis=30 -XX:+UseBiasedLocking -XX:+OptimizeStringConcat -XX:+UseFastAccessorMethods -XX:+AggressiveOpts -jar spigot.jar
Looking at your code, I can see the command pkill. pkill is a Linux command not available on Windows. You don't have to install linux on your pc. You can use a virtual machine or you can install linux subsystem on windows 10. Instructions on the later can be found here
Related
I'm using this script shell to run multiple commands, my problem is that each result of the command appears in a different window, my goal is to have one window with different tabs.
here is my code:
#!/bin/bash
echo "java -jar SBM.jar" >/tmp/ma_commande
gnome-terminal -e 'bash -c ". /tmp/ma_commande;read" ' -t "Building Manager"
rm /tmp/ma_commande
echo "java -jar UserAgent.jar" >/tmp/ma_commande
gnome-terminal -e 'bash -c ". /tmp/ma_commande;read" ' -t "User Agent"
rm /tmp/ma_commande
echo "java -jar PSM.jar" >/tmp/ma_commande
gnome-terminal -e 'bash -c ". /tmp/ma_commande;read"' -t "PSM"
rm /tmp/ma_commande
you can use these apps to split terminal window as you wish on Linux or Unix:
byobu: http://byobu.co/
screen: https://www.gnu.org/software/screen/
these are window manager and the more modern Tmux terminal multiplexer, and works on most Linux, BSD, and Mac distributions
I have a kiosk that shuts down every day using rtcwake, and this uses root user. I've used && to execute the boot script after rtcwake completes, however it then starts the browser as root causing problems.
This is the command I use:
echo debian | sudo -S rtcwake -m mem -u -t $(date +%s -d '3 days 7:45') && sudo -u debian -i bash $HOME/kiosk/bin/startup.sh &.
The sudo command does work to some extent. It calls the debian user, and executes the correct script, however, it still screws up my chromium preferences.
Here is the startup script:
echo debian | sudo -S hwclock -w
export HOME=/home/debian
#log boot time
echo "Booting at" $(date) >> $HOME/kiosk/bin/logs/boot.log
#echo debian | sudo -S service connman restart
echo debian | sudo -S at 15:30 -f $HOME/kiosk/bin/shutdown.sh
crontab -u debian crontab.txt
bash $HOME/git.sh
#sudo -i -u debian
#start kiosk
export DISPLAY=:0
chromium-browser --kiosk --disable-gpu
http://localhost/kiosk/Client/main.html &
#update ip
bash /home/debian/git.sh &
I'm wondering what could be causing chrome to be executed as root. I have no idea what is going wrong.
If you execute a command with sudo it will not change environment variables like $HOME. Since per user settings are stored in $HOME, this affects the executed program if it needs such configuration files. Check this for example:
sudo -u debian bash -c 'echo $HOME'
It will print the home folder of the calling user, not the home folder of the user specified trough -u. The sudo command supports the -H command line option to handle this, however if it works depends on the security police in use.
As a solution you can use the su command instead of sudo in this case:
... && su debian -c chromium
Since su itself is executed by root you won't be asked for the password.
You must enter a password to log into a new user shell.
The command needs to be modified as follows:
echo debian | sudo -S rtcwake -m mem -u -t $(date +%s -d '3 days 7:45') && echo debian | sudo -S -u debian -i bash $HOME/kiosk/bin/startup.sh &
This avoids needing a password to log in as normal Debian user, and executes the script.
I'm running kvm image from command line;
$ qemu-kvm -name openSUSE -M pc -m 2048 -drive file=hda -nographic
And I configured console=ttyS0 inside kvm image, so the kvm's console output is displayed in the host terminal output.
But when I try the same command in bash script, nothing displayed!
Can you please let me know how to capture kvm's console output from basn script?
be sure you script start with
#!/bin/bash
And set the full path to you disk file, for example
#!/bin/bash
qemu-kvm -name openSUSE -M pc -m 2048 -drive file=/foo/hda -nographic
Then set execution permission with
chmod +x script.sh
now try with
./script.sh
Cheers
I made a bash script to install a software package on a Linux system.
There are 4 packages I can use to install the software:
x86.deb
x86.rpm
x86_64.deb
x86_64.rpm
I know when to install which package on which Linux server manually, but I would like to find out "automatically" (in my bash script) which one I have to install.
Is there any command to find out?
I already know there is a way to find out the architecture (32-bit or 64-bit) via the "arch" command, but I do not know how to find out which package I need.
uname -m or arch gives you the architecture (x86_64 or similar).
You can probably figure out whether your system is based on RPM or DEB (e. g. Ubuntu is DEB-based) by asking both variants which package installed /bin/ls:
dpkg -S /bin/ls
will print
coreutils: /bin/ls
on a DEB-based system.
rpm -q -f /bin/ls
will print
coreutils-5.97-23.el5_6.4
on an RPM-based system (with probably different version numbers).
On the "wrong" system each of these will give an error message instead.
if dpkg -S /bin/ls >/dev/null 2>&1
then
case "$(arch)" in
x86_64)
sudo dpkg -i x86_64.deb;;
i368)
sudo dpkg -i x86.deb;;
*)
echo "Don't know how to handle $(arch)"
exit 1
;;
esac
elif rpm -q -f /bin/ls >/dev/null 2>&1
then
case "$(arch)" in
x86_64)
sudo rpm -i x86_64.rpm;;
i368)
sudo rpm -i x86.rpm;;
*)
echo "Don't know how to handle $(arch)"
exit 1
;;
esac
else
echo "Don't know this package system (neither RPM nor DEB)."
exit 1
fi
Of course all this only makes sense in case you know what to do then, i. e. if you know which package is to be installed on which package system with which architecture.
Running the command
curl -s https://www.parse.com/downloads/cloud_code/installer.sh | sudo /bin/bash
does not install the tool
I was able to install it easily on my other computer running 10.9.2
STEP : 1
Make a copy of this
#!/bin/bash
TMP_FILE=/tmp/parse.tmp
if [ -e /tmp/parse.tmp ]; then
echo "Cleaning up from previous install failure"
rm -f /tmp/parse.tmp
fi
echo "Fetching latest version ..."
curl --progress-bar https://www.parse.com/downloads/cloud_code/parse -o /tmp/parse.tmp
if [ ! -d /usr/local/bin ]; then
echo "Making /usr/local/bin"
mkdir -p /usr/local/bin
fi
echo "Installing ..."
mv /tmp/parse.tmp /usr/local/bin/parse
chmod 755 /usr/local/bin/parse `
to a file named install.sh and run it in your terminal as bash install.sh. This will install you parse in your Terminal.
STEP :2
Download the Gist from this link and run the file named install.sh in your Terminal preceded by bash