Questions tagged [scripts]

A script is a series of instructions written in a "plain text" file. The script interpreter (for example, Bash or another shell, Python, Perl, Ruby, etc.) reads the file and carries out the instructions as if they had been entered at the command prompt.

Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

AppImage unmount / process kill option

fresh started with linux, im trying to migrate from my win media srv to linux 20.04. i have qbittorrent appimage 4.4.3.1 installed, and the AppImage works fine. I have added the path to the appimage ...
user avatar
  • 1
0 votes
0 answers
6 views

Help with Ping and Rsync Script

Wondering if anyone is willing to provide help with a script. I have the following scenario: Home1 - System1 Home2 - System2 I have DNS fail over between these two locations. I'd like to implement a ...
user avatar
0 votes
0 answers
41 views

Bash script ignores shell script to run

I have a bash script, My script ignores one shell script to run... How can I make it run? 12th line isn't working.. clear pkill -f ts3server clear echo -e "${RENK4}TeamSpeak3 Sunucunuzun Query (...
user avatar
  • 35
0 votes
1 answer
31 views

Unable to find and run a script on a new SSD

I have just installed a new SSD on my machine as I was having storage issues. I am looking run a script (Nethermind for the ETH 1 Execution layer) and store the data on this SSD. New SSD disk image: ...
user avatar
0 votes
0 answers
16 views

Disable IPv6 before launching Citrix Workspace

I am unable to establish a Citrix session if I have an IPv6 address. After spending a few hours going down the certificates rabbit-hole, as guided by other threads that also related to the unable to ...
user avatar
1 vote
1 answer
32 views

How can I create a service in WSL2?

In WSL2, since there's no systemd, it's necessary to use service to monitor and deal with services. I can list all the services with: sudo service --status-all My question is simple: How can I add a ...
user avatar
1 vote
1 answer
66 views

Netifaces gives KeyError: 2 while running from cron

I want to schedule a cron job for running a server client application during startup. What I did is crontab -e and then put the following line @reboot cd path/to/folder && /usr/bin/sh /home/...
user avatar
1 vote
1 answer
107 views

Runing sh scripts in system startup, files not available error while running in root

I am a newbie in Ubuntu 20.04. I have a file structure for an application as - Home-->Folder1-->execute.sh,main.py, utils.py, ui.py etc.. What i intend to do is run the execute.sh file on system ...
user avatar
0 votes
0 answers
31 views

Creating an automated script for Ubuntu [closed]

This is what I need to do: Males | Use the season value as password $ mongo admin --eval 'db.createUser({user: "teddy001",pwd: "season", "roles" : [ { "role" : &...
user avatar
  • 1
2 votes
2 answers
181 views

uptime/tuptime Query

Because my umpc handles suspend/hibernation poorly, I've had to script a shutdown after timed idle. The main script: #!/bin/bash idletime=$((15*60*1000)) # 15 min in milliseconds #idletime=$((5*20*...
user avatar
  • 23
1 vote
1 answer
53 views

Ubuntu 22.04, bash script problem. TAR

Welcome friends. I wrote a bash script, I'm a novice programmer. It looks like this: #!/bin/sh TIME=`date +"%d-%m-%Y_%H.%M.%S"` FILE1="my_folder" FILE2="file_name.sql" ...
user avatar
0 votes
0 answers
20 views

Run command in terminal through gedit without opening terminal

I am sorry if this is asked before but I really cannot find anything,I basically want to open anaconda navigator from desktop by just double clicking on a *.sh file instead to opening the terminal and ...
user avatar
0 votes
0 answers
14 views

Installing PeaZip. Need Nautilus Scripts Folder for Context Menu Addition. Where Is It?

The instructions for PeaZip seem to say that, if I want PeaZip to appear in the Nautilus context menu, I should copy a specified PeaZip program folder to the system's Nautilus scripts folder. The ...
user avatar
1 vote
1 answer
38 views

What is the fish equivalent of set -e?

bash has a builtin called set with an "exit early" feature described as follows: -e Exit immediately if a pipeline (see Pipelines), which may consist of a single simple command (see Simple ...
user avatar
  • 19.5k
0 votes
0 answers
19 views

How do you prevent color output of "snap refresh" in a bash script?

I'm using a primitive script to automatically update APT packages and snaps. For debugging purposes I also log to a log file: #!/bin/bash # Print output and log it at the same time. exec > >(tee ...
user avatar
  • 745
2 votes
1 answer
95 views

How can I read a text inside of a txt file

my question is might be confusing. I have a bash script, I want this bash script to do a create a password by mkpasswd command, write this password to a .txt file, then read this password on this text ...
user avatar
  • 35
1 vote
1 answer
55 views

How to kill a program after it's executed from a script?

I have made a script that plays audio using ffplay directly onto the terminal. Now after it's executed I am unable to stop the sound without specifically killing it through the terminal or System ...
user avatar
0 votes
0 answers
22 views

How to run same script on multiples servers

I have some scripts that run some commands and send results to my email. I want to run the same script on multiple servers. How can I do that? I know there is an option "ssh". But I'm not ...
user avatar
0 votes
0 answers
24 views

How store incoming data from serial port in bash?

I try a little bash script for a analog serial modem to record an incoming call. The commands for voice mode, compression and silent dedtection will return OK. So I am ready to receive data. For ...
user avatar
0 votes
0 answers
41 views

Nautilus bhaviour preferences in 22.04

What has happened to the Preferences-Behaviour settings in 22.04. Is there another way to set the behaviour of script files when they are double clicked? There used to be that option in the nautilus ...
user avatar
1 vote
0 answers
15 views

How to reserve an autogroup percentage to one process in a script?

So I have this code: AUTO=$(cat /proc/sys/kernel/sched_autogroup_enabled) echo 0 > /proc/sys/kernel/sched_autogroup_enabled setsid -w taskset 1 ../esx 100000000 8 3 0 0 0 0 2>/dev/null & ...
user avatar
  • 11
0 votes
2 answers
30 views

newline in bash script

needing to check every hour a logfile looking for "unable to connect to the ldap", I've put in cron hourly this script: #!/bin/bash > result cat logfile.log | grep -a 'unable to connect ...
user avatar
  • 530
0 votes
1 answer
48 views

How to call script B from script A as if script B is in script A's location

To the detail,script B is at a location different from that of script A. Script B will also call other scripts. If I call script B from script A, bash will report the scripts called by script B do not ...
user avatar
0 votes
1 answer
49 views

Start service from systemd with ubuntu

I'm trying to launch a .jar file (Spring Boot 1.4.0) through systemd and it's returning error exit code 126 Code that is in the system folder /etc/systemd/system/Painel.service [Unit] Description=...
user avatar
1 vote
1 answer
46 views

Can be Bash Script used to automate proces for multiple files in an open program? for exmaple GIMP?

So i know to open a program, i just have to type the name of the program in. Example: #! /bin/bash gimp now i wanna know can i use this script to send like commands to gimp. Like open Gimp and then ...
user avatar
0 votes
0 answers
34 views

Can some one help me with sed command?

{ echo finde="LOG_$(tac /var/log/lol.log | grep -m 1 "ber" | cut -d " " -f 11 | sed -e 's/\,//g' | sed 's/ber=//' && date | cut -d " " -f 2,3,4,5,...
user avatar
  • 1
0 votes
1 answer
28 views

Bash script to load/unload pulseaudio module

I would like to create a bash script that loads the pulseaudio loopback module in the event it is not already on, and vice-versa unloads it in case it is already running. So far, I resorted to writing ...
user avatar
  • 153
-3 votes
0 answers
40 views

Wanted set timeout for my script

I have a script where I want to set a timeout when any one of the commands not get executed, Please help me here. #!/bin/sh df -H | grep "LVroot" | awk '{ print $5 " " $1 }' | ...
user avatar
0 votes
0 answers
11 views

Having problem to create users through a shell script in Ubuntu 20.04 Server

user1=S211050 user2=4000 clear while [ $user2 -ne 4050 ] do user2=`expr $user2 + 1` echo $user1$user2 useradd -m $user1${user2} # passwd -d $user1${user2} echo -e "User123\...
user avatar
0 votes
0 answers
26 views

Bash command to check if screen timed-out / screen locked / user is inactive

I use crontab to run a script that takes a screenshot of my screen every 20 minutes, then adds it to a specific folder. However lots of times I leave my computer to do other things and the screen ...
user avatar
  • 101
0 votes
0 answers
29 views

Bash Script to open Terminal, execute script in sudo (no password) and remain open?

I want to create a bash script to open a terminal, execute a command as sudo (without entering password) and not have the terminal close after? Requirements: I am trying to launch xmrig which is ...
user avatar
0 votes
0 answers
27 views

udev test run oke but script doesn't run

I've been trying to make a rule to run a script when i (dis)connect my qwerty keyboard. This way i can automatically switch to the azerty layout from my laptop. Super+space is a shortcut to switch ...
user avatar
  • 1
0 votes
1 answer
58 views

Is there a way to keep Zenity open after preforming my shell script?

I have made a zenity list that opens up the terminal to run a shell script but after it is ran zenity closes is there a way to keep zenity from closing? Here is my script - #!/bin/bash zret="$( ...
user avatar
  • 1
0 votes
0 answers
46 views

crontab and shellscript

If I have a shell script that must do a job 5 times a day at different time according to a specific table, now, I must run for manually each time how I can make it do the job automatically by ...
user avatar
  • 19
0 votes
1 answer
58 views

error trying to redirect output of awk script to a new file

I am working on the following code in an awk script and I need the output to be redirected to another file within the same script. What I try to do in the first block is to round the decimals of the ...
user avatar
0 votes
0 answers
19 views

Cant trace sed error

My code is big so i will share the github link here: https://github.com/troopek/TropX Clone it and run the main.sh file with bash, then to recreate the error you will type in 2 and enter in the cli ...
user avatar
0 votes
1 answer
22 views

Delete all lines from a line with certain string until another line with a diffrent string in a file

file.txt: start some text works "HELLO" foo test sum other end start som "other" line with text 'also' thing foo end and I want to delete the line in which "HELLO&...
user avatar
0 votes
1 answer
38 views

Creating folder based on txt file name

I want to ask how could I make a directory based on the text file name For example, I have a text file named Game,Board,Risk.txt What I want to do is to create a folder within the folder like /Game/...
user avatar
  • 1
0 votes
0 answers
18 views

'canberra-gtk-play' is not recognized as an internal or external command

"'canberra-gtk-play' is not recognized as an internal or external command, operable program or batch file". I don't know why this error appears. pls help me fix this bug
user avatar
0 votes
1 answer
225 views

How to create json with file name, size and version in a directory?

I want to create json holding file name, size and version of files inside a directory. Here version number is a string written inside every file (each file is a lua file containing function like ...
user avatar
  • 1
0 votes
1 answer
81 views

Shell scripts with table

I want to run a cron job monthly, weekly, daily but in everyday the hours and minutes will be changed as shown in the below table. So, how can I use a "for loop" to do this? The hours and ...
user avatar
  • 19
0 votes
1 answer
39 views

Are there common scripts one can use in its postinst, postrm, etc.?

I'm working on many separate projects each of which comes with a separate Debian package for Ubuntu. For all of the projects including a service, I end up doing similar things in their preinst, ...
user avatar
  • 2,440
1 vote
3 answers
67 views

systemctl not working from shellscript but works from terminal

systemctl stop tomcat_tomcat9.service If I issue the above comand from terminal it is working but if it is executed from shell script I get the below error. Invalid unit name "tomcat_tomcat9....
user avatar
  • 111
0 votes
1 answer
33 views

Getting error while executing PowerShell cmdlet on ubuntu machine

I was currently running PowerShell on ubuntu machine with the help of VS code by importing packages. The commands which I used are: sudo apt update; sudo apt-get install libunwind8; wget https://...
user avatar
  • 1
0 votes
0 answers
13 views

How can I use terminal commands as pattern in grep or any other program? [duplicate]

I've been writing a small script, and one of its functionalities is to register the computer in landscape. To do so, I have to first install landscape and then run this line with the following data: ...
user avatar
0 votes
0 answers
53 views

Rename all files and directories wihtin a directory to uppercase [duplicate]

So, i have a game folder (for example, named: GAME1) which contains 250000+ files and directories. Everything inside needs to be renamed from lowercase to uppercase . I can open a single directory (A) ...
user avatar
0 votes
2 answers
132 views

How to launch multiple Gnome-terminal windows in a shell script and continue only after these have finished

In a script, I want to launch a number of Gnome Terminal windows, and then proceed with the script only when the windows are closed. I have a shell script containing: command 1 gnome-terminal ./...
user avatar
0 votes
0 answers
46 views

Init Script is failing?

I am using a init script for databricks cluster and the below is the script: #!/bin/bash apt-get -y update && apt-get install -y libudunits2-dev libgdal-dev libgeos-dev libproj-dev This ...
user avatar
  • 1
0 votes
0 answers
35 views

Function in Shell script

I want to apply this function in split like this count=$(find .. -maxdepth 1 -type f|wc -l) N=int($count/32)+1 Split -l $n file.text But it does not work Anyone done it before ?
user avatar
0 votes
0 answers
151 views

Issue with Linux multi user creation using bash script

As per our requirement we provided our devloper group: devs:r-x to /var/log/httpd directory. Now I'm creating a Linux function , which take the developer's first name and create a linux user in our ...
user avatar

1
2 3 4 5
128