Questions tagged [scripting]

A script is a sequence of commands or instructions that are executed by an interpreter program rather than compiled into a standalone executable program.

653 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7 votes
1 answer
687 views

Check if a remote machine is in a Veritas cluster

How can I verify that a remote machine is part of a Veritas cluster? I just created the following ssh command to verify if the remote machine is a VRTS cluster or a Linux availability Red Hat cluster ...
yael's user avatar
  • 1,521
6 votes
1 answer
845 views

Mac equivalent application "shortcat"

There is a mac application called Shortcat and it make me envious. For those of you averse to clicking links here is a summary: Keep your hands on the keyboard and boost your productivity! ...
Derek Ekins's user avatar
5 votes
1 answer
456 views

How to create a real copy of file descriptor stdout and stderr without using unbuffer / script / tee just with bash built-ins?

My goal is to duplicate, redirect all output (stdout and stderr) of an application (apt-get) to a file while retaining the usual behavior of the application (apt-get), stdout and stderr. How to ...
adrelanos's user avatar
  • 1,786
5 votes
0 answers
298 views

programmatically alter kde file associations

Problem: In kde I want to remove a particular file association from every file type Details: I wanted to try out clamTk as a companion to clamAv. It didn't suit my needs so I uninstalled the ...
Wolf's user avatar
  • 91
4 votes
3 answers
592 views

Parsing csv file to filter rows basing on a matching set of characters from a column value

Consider the following csv file: A,3300 B,8440 B,8443 B,8444 C,304 C,404 M,5502 M,5511 The real csv file is really big (around 60,000 rows) but I only included a small version for ...
Marco's user avatar
  • 41
4 votes
0 answers
378 views

Launch Openbox actions through script or cli

I was wondering if it is possible to run openbox actions, like the ones that can be found on rc.xml like MoveResizeTo , through a console command so I can launch it from terminal or inside a bash ...
Lupccs's user avatar
  • 51
4 votes
0 answers
862 views

How to rsync files when a USB stick is mounted

Tried a little project to aid in transferring control files from my home computer to my work shop computer. The outcome confuses me. What am I doing wrong? The home computer is running Fusion 360 ...
Wirewrap's user avatar
  • 141
4 votes
0 answers
188 views

How to dynamically control the audio volume based on current decibels

Since the Internet videos have different sound volume levels I am wondering is there a way to dynamically decrease the audio volume if it's above certain decibels to a normal value. Could someone ...
ispasov's user avatar
  • 175
4 votes
1 answer
322 views

How do I schedule a cron task to run

I'm looking to crontab a script every hour starting Friday at 5pm... ending Monday at 5am. This script checks if it's completed this week and if it's currently running. If no/no, start task. Off the ...
WernerCD's user avatar
  • 1,314
4 votes
1 answer
303 views

Remote script cleaning up

I run a remote script using ssh: local script: local_command ssh -p 222 user@server 'sh -s' < ./remote_run.sh remote script: some_command & sleep 10000 trap 'echo exiting' SIGINT SIGTERM ...
Dmitry Eskin's user avatar
4 votes
1 answer
2k views

GRUB 2 scripting: convert device name in GRUB notation into a Linux device name

I'm trying to use partition labels (or UUIDs, that does not matter) to select root partition without use of an initrd/initramfs. With initramfs, this is fairly easy: root=LABEL=... or root=/dev/disk/...
intelfx's user avatar
  • 5,141
3 votes
0 answers
181 views

Struggling with systemd and user permissions for backup script

I could use some help with figuring out the right way to accomplish what I need using systemd. I feel like I have backed myself in between a rock and a hard place and am not sure where to go. here is ...
Xixor's user avatar
  • 101
3 votes
0 answers
244 views

How to run a script when a directory is accessed?

I want a device mounted to a mountpoint only when it is needed, when it is accessed (for the first time). How to run a script when a folder is accessed in Linux (or Ubuntu)? Please note that the ...
ñull's user avatar
  • 151
3 votes
3 answers
705 views

How to grep data of a new line when capturing a keyword?

I have a file which contains below sample line having a common keyword P00001121 in each line. [H00,P00001121] CHANNEL__OPEN:TCP_ADDRESS='10.32.130.202' TCP_PORT='80'" [H00,P00001121] COMMS_QUEUING:...
Satya's user avatar
  • 31
3 votes
0 answers
2k views

systemctl doesn't work from crontab

I'm trying to run a script calling systemctl from crontab but the command is not being executed. Other scripts work fine from crontab. The script works when executed in a terminal. This is the script:...
Bauglir42's user avatar
  • 123
3 votes
0 answers
1k views

Automation of ssh change password on 1-st login (no expect)

My account was copied from 1 to a big number of hosts. On every host on 1-st login I get: WARNING: Your password has expired. You must change your password now and login again! Changing password for ...
Dmitresso's user avatar
  • 131
3 votes
2 answers
1k views

Script or Program to discover hosts on network

Explanation: I need a script or program to discover devices on my network. I was thinking maybe doing the scan with nmap and I need to display just the name of device, what it is, and also the ip ...
iamr00t's user avatar
  • 139
3 votes
1 answer
592 views

Advance autologin via 2 jumphost/passphrase

I need to find a way to autologin on Remote Machine. There are several way in which we can do this but this is little tricky for me. Auto Login to a remote machine and execute command or script and ...
Poo's user avatar
  • 95
3 votes
1 answer
2k views

Upload to youtube using shell script

I've searched the youtube API but still not clear whether this is possible. I have a shell script that uses FFMPEG to convert a video. After being converted I want to have the video automatically ...
Bachalo's user avatar
  • 1,081
3 votes
0 answers
1k views

Converting script from init to systemd

I am moving from Ubuntu 11 to 16, and would like to convert custom-made scripts to work with Ubuntu 16 I have started and completed First init script but need a bit of help on Second init script. I ...
Stain Less's user avatar
3 votes
2 answers
1k views

Bash Scripting: How do i limit the amount of options in a select loop?

When you use the select loop to present the elements of an array as an option, it will display it all at one time. Is there a way to present the options to the user for like 25 options at a time?
ushaldi's user avatar
  • 31
3 votes
1 answer
3k views

How to kill inactive user logins on Solaris?

On a Solaris 10 server if i do a w, I get this: 12:26pm up 85 day(s), 1:13, 6 users, load average: 0.38, 0.36, 0.38 User tty login@ idle JCPU PCPU what blah pts/1 ...
jasmaar's user avatar
  • 305
3 votes
3 answers
84 views

Converting rows to row groups

Can somebody please help me with the below conversion shell script ? Source File File 1 : for example EXCHANGE_ID : 192, 410, EXCHANGE_DTTM : 2015-06-11+02:18:40+0000,...
arsh's user avatar
  • 81
3 votes
1 answer
3k views

How do you make a toggle key using Autokey?

I want to use Autokey to toggle the e key on and off in a program called "xyz". So if I press e, the program thinks I'm holding down e. I press e again, it thinks I released it. How do you do this ...
user111973's user avatar
3 votes
0 answers
185 views

Automatically restarting process in the X server

I would like to know how to have a process that starts with the X server and automatically restarts when it stops running. I am running Ubuntu 14.04 with a KDE 4.13.3 desktop. I am running the ...
ZeroKelvinKeyboard's user avatar
3 votes
0 answers
112 views

End recording once silence is detected

I've been using something like this up to now: End sox recording once silence is detected But now I'd like for the audio source and recording mechanism to be separate. I can get the source as an ....
Eugene Lee's user avatar
3 votes
0 answers
66 views

Notifying program that X session is shutting down

Ok. I understand X session is a bit vague here so let me clarify what I mean by the phrase. I mean the situation where a person has been presented with a display manger screen ( eg xdm, kdm, gdm, mdm, ...
Mouse.The.Lucky.Dog's user avatar
3 votes
0 answers
1k views

gnome-terminal cmd leaving processes open after closing parent window

The following simple command should demonstrate my issue: gnome-terminal --tab -t "Tab 1" -e "/bin/bash" --tab -t "Tab 2" -e "/bin/bash" This should open a new window with two tabs and an active ...
Joe's user avatar
  • 31
3 votes
0 answers
484 views

Using tcpdump to log blacklisted IPs

I am using tcpdump to log traffic outbound on a network. I would like to be able to log traffic on a host or IP-only basis but then I would like to be able to log large numbers of potentially ...
Trevor's user avatar
  • 31
3 votes
0 answers
2k views

Cron file syntax checker/validator script

Does anyone know a script (bash, perl, php ...) to validate the syntax of crontab files? I found this http://www.intuitive.com/wicked/showscript.cgi?053-verifycron.sh but just Vixie cron notation is ...
OpeCha's user avatar
  • 31
2 votes
1 answer
191 views

How to stop program of non-interactive SSH call without pseudo-terminal

Let's say I start a program with a non-interactive SSH call (without pseudo-terminal) and exit the session via CTRLC: $ ssh user@server -- sleep 123 ^C This way, the program, in this case sleep 123 ...
finefoot's user avatar
  • 2,960
2 votes
1 answer
81 views

How to get static (snapshot of) pw-top?

I need to get a static output from pw-top, of pipewire, for a script I want to make. I really just need a list of pipewire devices. For example, I want to be able to run pw-top | grep output and then ...
sef sf's user avatar
  • 72
2 votes
0 answers
53 views

How to figure out why `bash simple_script.sh` works but `bash < simple_script.sh` doesn't?

I have a very simple script, simple_script.sh, consisting the following three lines bpeek 123450 bpeek 123451 bpeek 123452 If I run $ bash simple_script.sh all three bpeek commands in simple_script....
kjo's user avatar
  • 14.8k
2 votes
0 answers
391 views

mdadm rotate hot spare

It can be a good idea to have a hot spare in some RAID systems. It can be a bad idea for the hot spare to sit idle for months/years, potentially hiding a defect, until an active drive fails and ...
Eric Towers's user avatar
2 votes
2 answers
1k views

How to merge txt file with the same name from all subdirectories

I have folders with a lot of files, Each folder has txt files of the same name, I want to merge all txt files from all subdirectories into a single folder. Example: /home/parent/Folder1 ===> ...
Surprise Awofemi's user avatar
2 votes
0 answers
217 views

Blink LED on different times on Linux

I made a python program to blink LED on Ubuntu installed on Raspi3b. It's running and I could blink the LED. Next steps are to blink at different times: when I power on, after ssh is active, and the ...
PeRGeLAdAm's user avatar
2 votes
0 answers
39 views

Receive notification new messages localhost MAC OS?

I need to receive notifications when my backup script is executed successfully. First I tried to send an e-mail to Thunderbird on localhost, but newer version of Thunderbird does not have Unix mail ...
José Ricardo Ganiko's user avatar
2 votes
1 answer
576 views

Get the full path of running script from /proc

If a running script was called directly, as in not by calling its interpreter with the script's path as an argument, how can the full path to script file reliably be retrieved regardless of the ...
Melab's user avatar
  • 3,828
2 votes
0 answers
23 views

Script configuration issues

My purpose is to allow user A to run a specific script owned by user B but with user B’s profile loaded. This is on a Solaris maachine. I have users A and B, I set this line: in the sudoers file, so ...
Gerald Tan's user avatar
2 votes
1 answer
626 views

Which Window Managers are Shell Scriptable?

I'd like to start doing more powerful things on my desktop with (simple!) scripting and would like to know which environments/ window managers support this. Example: For web development, I have to ...
Nick's user avatar
  • 1,081
2 votes
0 answers
43 views

How can I know/list the properties of any application macOSX to be able to use osascript/apple-script?

I'm a newbie for osascript. I want to code some automated script/apple-script. I've searched and tried some tutorials about apple-script but it's a simple application like "Reminders" "Finder". I ...
Thanasarut's user avatar
2 votes
0 answers
179 views

Fedora: Create multiple workspaces with a script

At the moment I'm using Fedora with Gnome. I want to create a script which will be able to start the applications on different workspaces. For me it's clear that I could create a script which just ...
Necessary_Function's user avatar
2 votes
1 answer
827 views

Cron job sends empty mails

I have written a shell script which checks the NTP service on all our servers and mails the output to specific email. When I execute it manually, it runs fine and I'm receiving email with valid ...
sri's user avatar
  • 21
2 votes
0 answers
152 views

Filter Bluetooth Devices from ACPI Command Output

I have a battery status script for my laptop which parses the output of acpi -b. Since my laptop only has one battery this has worked fine for years. However, I recently purchased a bluetooth ...
JShorthouse's user avatar
2 votes
2 answers
1k views

Copying/Moving folders where destination folder already exists

I am writing a bash script to copy/move a folder called "folder" to a directory that already contains "folder" and I would like the contents to be merged. I am attempting to use a solution from this ...
puyanera's user avatar
2 votes
0 answers
447 views

Detect network interfaces with carrier on boot

I have a Debian system with more than one ethernet port. I'm currently running a script on boot which assigns a static IP to one of the ports (by updating /etc/network/interfaces and restarting ...
Miral's user avatar
  • 341
2 votes
0 answers
208 views

How to trace script execution events

My goal: To receive events from the kernel when a file/script is opened for execution with the absolute path of the file (or maybe the working directory, to resolve the absolute path of the file). I ...
faraopera's user avatar
2 votes
0 answers
88 views

Using killall with -u and -o options

I wanted to confirm some details with the killall -o option. I tested it on some ssh connections I created under the user rick. First I printed a list of all of ricks ssh connections along with the ...
DizzyNYC's user avatar
2 votes
0 answers
1k views

Evaluate the similarity between two video files

I'm looking for a method that reliably gives me a "mathematical distance" of two videos from one another. Similar to how the Levenshtein distance can be used to get the distance from a ...
What's user avatar
  • 356
2 votes
0 answers
815 views

How to script AT command to modem?

Every time my USB modem (/dev/dlinkModem) gets unplugged it defaults to "radio disabled mode" (AT+CFUN:4). I can easily enough call AT+CFUN:1 through the minicom application console to enable radio ...
wyldcard's user avatar
  • 121

1
2 3 4 5
14