All Questions
186
questions
2
votes
2
answers
76
views
Avoiding accidental execution of python scripts as bash scripts
I like to run my python scripts directly in bash like so
$ ./script.py
But sometimes I forget the shebang line #!/usr/bin/env python3, and it has the potential to overwrite a file named np if the ...
0
votes
0
answers
140
views
Cannot activate Python virtual environment from within shell script (zsh)
I cannot activate a Python virtual environment from within a shell script (zsh).
I have tried the following:
#!/bin/zsh
conda create -n myenv python=3.10
conda activate myenv
It sends me the error ...
2
votes
1
answer
148
views
Algorithm to find longest common substring
I'm having a bit of trouble coming up with a general solution to the following problem.
First a bit of context.
End goal: set file permissions on all files and directories created by a rpm
My plan was ...
1
vote
0
answers
88
views
In Debian 11 docker container, I cannot type lowercase S when I switch to bash from zsh
When I connect to my Docker container with Debian 11 via ssh, I have it set up such that zsh is the main shell. When I switch to bash (by typing bash) I lose the ability to type the lowercase letter s ...
0
votes
0
answers
996
views
Using rsync and ssh inside python script to specific folder
I am attempting to make a copy of the /home folder on a remote Raspberry Pi (pitwo) to a local Raspberry Pi (pizero) via rsync and ssh. The local Pi has a hard drive connected that is shared using ...
1
vote
1
answer
285
views
How to extract numbers from rsync stats output
I am using rsync to back up a Raspberry Pi. The rsync command runs inside a python script:
import os
os.system('sudo rsync -avzh --stats /etc /home /usr /mnt/BigMac/BigMac/PiBackups/PiZero')
The ...
1
vote
1
answer
957
views
How to have one process listen to a serial port that another process is writing to?
I have a process (in bash) that writes data to a serial port. I would like to see that data, but instead of hooking up an Arduino and showing the data on a display, I thought it would be easier to ...
1
vote
1
answer
399
views
How to find the "pattern" in FASTA file and record the cordinates along with header
I am looking for a solution to search for a string of 17 base pairs in the FASTA file that is the human reference genome.
To clarify, in simple words and put the resources, i have tried grep function ...
0
votes
0
answers
41
views
Reenter interrupted session with running script
On a server I ran a debug intense script and unfortunately my session was interrupted (broken pipe).
I logged in again and apparently the script is still running:
PID USER PR NI VIRT ...
0
votes
0
answers
256
views
Singularity exec gives environment error when running python script, but the python script can be run interactively fine
When running these two commands sequentially in a terminal,
singularity run /home/___/singularity_containers/singularity_container.simg bash
python3 /home/__/__/___/src/python_file.py
Everything ...
0
votes
1
answer
608
views
How to run singularity container and python code from within the singularity container in a shell script?
I am trying to start a singularity container and then run a python script from within that container. The commands work individually if I run them outside, but as soon as I put them in a shell script ...
0
votes
0
answers
54
views
I created a cronjob years ago, now it is still running on the server but I can't locate it with "crontab -e", what can I do?
two years ago I created a cronjob which execute a python script to backup stuff. Now, the thing is that this cronjob is still running:
/var/log/cron.log.1:Oct 9 20:00:02 syslogngsrv CRON[28292]: (...
0
votes
0
answers
8k
views
Job for service failed because the control process exited with error
I'm trying to run a service manually, and everytime I get the folling messages:
user1@machine:~/Tools/systemd_tools$ sudo systemctl status tool_fd.service
● tool_fd.service - automatic tool service
...
1
vote
1
answer
579
views
Bash $_ in Python os.system
I just ran into the following
grep -h ^ID= /etc/*-release
python -c 'from os import system; system("echo hello; echo $_")'
for RHEL, this gives what i expect ($_ expands to hello):
$ grep -...
1
vote
1
answer
384
views
How to properly make a SSH-call LOCALLY async/background/independent/...?
Use-case
I have a backup software able to read data to be backed up from named pipes. I want to use that feature to backup database dumps of e.g. MySQL and PostgreSQL which are hosted within multiple ...