Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 10 months ago.
Improve this question
Recently I started working on Ubuntu 18.04.4 LTS machine. I have created a small project which should run from a docker container with command:
docker run docker_name "2022-04-11"
This command runs like a charm when I run it manually (I have sudo permissions), but breaks when I try to run it from sudo crontab.
I tried to log all output from the crontab to file myjob.log with command:
0 1 * * * docker run docker_name "2022-04-11" >> /home/projects/project/myjob.log 2>&1
Then I saw that myjob.log file contains an error message:
/bin/sh: 1: docker: not found
It got me confused. Why I can run docker commands, but crontab can't?
Check you crontab you are probably missing something like:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
If you are running as your user not root you have to add it to the top.
The short of it is that your $PATH isn't set so you can't find the docker command.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I connected via ssh to my Ubuntu server.
And I want to create a screen session with a command to run sh script.
I'm trying to do it this way:
screen -dm -S myserver server/start.sh
But nothing happens.
Even screen list is empty.
screen -list
No Sockets found in /run/screen/S-root.
How can I fix it?
Ubuntu 20.04, Screen version 4.08.00 (GNU) 05-Feb-20
Also, I want to put this command on system unit, to make systemd to run the script at system boot. But I can't to make it runs even using a command via ssh.
The problem was that script was failing with an error. I should make cd to run the script.
screen -S myserver -dm bash -c "cd server;sh start.sh"
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I've got a shell script which is supposed to install some packages from the Arch User Repository. The shell script is as follows:
#!/bin/sh
pacaur -S google-chrome --noconfirm # install google-chrome
The problem is, if I run this script using sudo sh script.sh, it'll just return: "you cannot perform this operation as root". If I run it without sudo, it'll ask for sudo later on when installing.
My question is, how can I avoid it asking me. I'd like this script to take care of installing all my packages just as is, without requiring me to actually give access manually. Would there be a way?
If you run sudo -v before calling the pacaur, this will ask you for your credentials and cache them for the next 15 minutes. You don't need to call sudo with pacaur anymore. As long as pacaur finishes running within the next 15 minutes, it will not have to ask for credentials again.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I'm working with a Debian based Linux. Have a script that needs to be executed on boot. Found these instructions describing on how it needs to be one. My only difference is that I need to run a script with a parameter at bootup (myscript.sh --some-option 23). I can't use a wrapper script. I won't explain why, but I will only say that I just can't. Does anyone know how to do it?
The cron daemon has a #reboot command. That runs your script at reboot. So simply edit your crontab and add a line like this:
#reboot /your/script/test.sh
Assuming you are using a system with systemd, this is easy enough. Create a new service file "foo.service":
[Unit]
Description=Powertop autotune
[Service]
ExecStart=/usr/sbin/powertop --auto-tune # XXX replace with your command
[Install]
WantedBy=multi-user.target
and then install it:
ln -s /home/kris/Scripts/systemd/powertop.service /lib/systemd/system
systemctl enable powertop
systemctl start powertop
Obviously your paths and particulars will be different. In particular, the /lib/systemd/system might not be the right place in your distribution.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I've tried to install docker on my machine, following the instructions for Precise 12.04 found here.
When I try:
curl -sSL https://get.docker.com/ | sh
I get the result:
Either your platform is not easily detectable, is not supported by this
installer script (yet - PRs welcome! [hack/install.sh]), or does not yet have
a package for Docker. Please visit the following URL for more detailed
installation instructions:
https://docs.docker.com/en/latest/installation/
My kernel:
$ uname -r
3.13.0-61-generic
You can download the short installer script to take a look at why it is giving you this message:
curl -sSL https://get.docker.com/ >install-docker.sh
$EDITOR install-docker.sh
Doing that, I see several checks for lsb_release. Is your system missing that command? If so, see this to install it. Or maybe it’s not returning “ubuntu”. If you fix this, the docker installer script may work fine.
If that doesn’t work, you can hard-code a case for your OS (Mint?) in the ubuntu|debian case (line 243), like:
ubuntu|debian|linuxmint) # or maybe you’ll need here: *)
When done editing (or installing lsb_release), run the script to see if it will complete:
sudo ./install-docker.sh
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I'm new to linux. I have Ubuntu and I would like to run a .run installer in my Downloads folder. The name of the run file is "xampp.run"
I've read that you first have to run
chmod +x xampp.run
to change mode to installer and then run
./xampp.run
to run the installer. However, nothing happens when I try these. I'm running from root#ubuntu.
This is what I've done in my shell.
Download and install XAMPP for x86_64 Linux.
.run files are executables, not unlike windows-installers(M$)
You may need root permission to execute the file.
su to root, and enter the root password, or use sudo before your command
then either cd to the directory where the .run file is
or use "absolute addressing" and
type in a terminal shell...
sh (filename).run
Generally you can evoke a help screen (not always) by adding --help on the end.
sh (filename).run --help
(this may give you options to apply to the install script.)
Hope this helps
You should download 64bit version of Xampp.
this steps is for ubuntu user
sudo chmod 755 xampp-linux-1.8.2.0-installer.run
sudo ./xampp-linux-1.8.2.0-installer.run
(This will extract all the packages to the /opt/lampp directory)
Then start the service
/opt/lampp/lampp start