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.

1,151 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
1answer
1k views

Execute script on every start, wakeup and activation!

I want to execute a script on every start up, wake up and activation. In the current setup the script is executed in: /etc/rc.local /lib/systemd/system-sleep It works so far, but if I reactivate my ...
5
votes
0answers
104 views

Nautilus shortcut for “Open in Terminal” and gvfs

I am trying to assign a shortcut to "Open in Terminal" in Nautilus. I have implemented the solution here with nautilus-scripts and the Perl file. While this solution works well for local ...
5
votes
0answers
33 views

Show progress in nautilus for custom script

I'm using ubuntu 19.10 without any modifications and I got a couple scripts set up so I can execute them with the contextual right click menu. The thing is, once they are going, they are completely ...
5
votes
1answer
1k views

In Ubuntu 18.04 (GNOME desktop), a .deskotp application launcher pointing to a script doesn't run said script

Well for Unity/Ubuntu 16.04 I added a custom script to the quick launch menu by added a *.desktop file inside ~/.local/share/applications/ With content as: [Desktop Entry] Type=Application Terminal=...
5
votes
1answer
302 views

Ubuntu touch and cron jobs

I created a script to enable flight mode at night and disable it in the morning. I'm adding checks to avoid enabling it if there is phone of web activities. The script has been added to cron (5 minute ...
5
votes
0answers
1k views

How do I force nmcli to reconnect to different uuid?

I have a bash script that checks my network environment and mounts shares accordingly. If I'm at work and have a hard-wire connection to the LAN, then I'd like to activate a hotspot connection for ...
4
votes
0answers
142 views

Delayed jobs in crontab

My OS is Ubuntu 18.04.3 LTS. I have 2 crontab jobs scheduled to run every morning at 4:00 a.m. and 4.05 a.m. 00 4 * * * sh /home/developer/script/batch_load1.sh >> /home/developer/script/log/...
4
votes
1answer
356 views

Halt the 'shred' command in bash script if it encounters errors

I have a workstation that we have set up to sanitize multiple hard drives. I run a script that detects the hard drives and then runs the 'shred' command on each one. The problem is, if any of the ...
4
votes
0answers
1k views

How to automatically bring up CAN interface in Ubuntu 17.10

In previous versions of Ubuntu I have been using this script to automatically bring up an network interface for a USB to CAN bridge device, whenever the device is plugged in: $ cat /etc/network/...
4
votes
0answers
524 views

Script to enable caffeine-indicator

Caffeine-indicator works well for me when I activate it manually. Right now the coffee cup is always displayed on the panel. But I have to click it, which makes a 2nd indicator appear, and then select ...
4
votes
1answer
976 views

How can I run a script when I unmount a particular usb drive?

I am trying to sync between a folder and usb drive, so that a) when I plug in a particular usb drive, a script runs to copy any newer files from the usb to the folder; and b) when I unmount the ...
3
votes
0answers
113 views

How do I backup multiple internal drives to multiple external drives?

I have 4 internal drives (a,b,c,d) that I would like to back up to external drives (a_bak, b_bak, c_bak, d_bak; respectively). I've attempted this using udev rules, from HERE, but I can't seem to ...
3
votes
0answers
213 views

Gnome-screenshot doesn't always work from keyboard shortcut

I created a script to screenshot and save the screenshot directly, and I wanted to bind it to a keyboard shortcut. However, it only works about 50% of the time. If I run it from the terminal, it works ...
3
votes
0answers
477 views

How can I add a command to initramfs / initrd to execute before mounting the root partition?

ubuntu 18.04 64-bit I have a setup which has three separate block crypt devices, plus a non-encrypted /boot. If I had started with a clean sheet of paper, I could have done it with two, but it would ...
3
votes
0answers
89 views

Switching between several languages using keyboard shortcut

I use multiple (N) keyboard mappings (languages) and it's confusing and time-consuming to switch between languages the standard way - pressing Alt+Shift several times (up to N-1) until I get the right ...
3
votes
0answers
177 views

Running login script in Unity for 16.04

I have a Ubuntu 16.04 client computer that is connected to LDAP (FreeIPA). It takes its users from IPA LDAP. Accordingly, we have a mkhomedir directive in /etc/pam.d/common-session file that creates ...
3
votes
1answer
10k views

Job for NetworkManager.service failed because the control process exited with error code

I am Running Ubuntu 16.04 KDE. See this for specifications. $ uname -a Linux ElMaverick 4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux $ cat /etc/...
3
votes
0answers
199 views

How to launch only shell scripts from Nautilus

This is related to questions like “How do I run executable scripts in Nautilus?” or “How to execute a script just by double clicking like .EXE files in Windows?”. I would also like to have shell ...
3
votes
0answers
1k views

What is wrong with my Systemd service file?

I've been trying to get a systemd service to work for a while now, but with no luck. What I am trying to do is create a startup script that will start a java program for a modded-Minecraft server. ...
3
votes
1answer
825 views

how to run a python script after resume

I have a python script that I need to run after resuming system from suspend. I have created an executable in /etc/pm/sleep.d/ #!/bin/bash case "$1" in hibernate|suspend|thaw|resume) ...
3
votes
0answers
79 views

I need a program to run every time a file with a specific extension is added to a folder, in which that program uses that file as an argument

This question is a bit more specific than related questions because of the following requirements: I need a program to run when a new file is added to a folder using scp. The file can only have a ...
3
votes
1answer
685 views

get sh to execute the commands inside from a PDF compiled with LaTeX

I have a solution of a PDE in an executable file called demo_poisson, which I can double click to get the window to open and show the graph of the solution. I think it works with VTK but I'm not sure. ...
3
votes
1answer
767 views

USB UDEV Rule Appears to Run Script Many Times

I wrote a custom udev rule that looks for a specific usb device to be plugged in, and then runs a few gphoto commands. See below: ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="04a9", ATTRS{...
3
votes
1answer
665 views

What is the most secure way to use sudo permissions in a script?

I have a bash script which needs to perform some actions while using sudo, both with root user permissions and permissions for other users, such as main user on a postgres database. These actions need ...
3
votes
0answers
522 views

Creating a Custom Live USB Lubuntu with Scripts

Working on a project for a client, the deliverables are a lightweight Linux Distro (I'm using Lubuntu versus Puppy or Mint due to familiarity), is Live Bootable from a 8/16GB USB drive and upon ...
3
votes
0answers
1k views

How to have my bash script executed every time the touch screen receives input?

I am looking for a way to trigger a little bash script I wrote to run every time the touchscreen receives input. I am assuming there is some sort of event handler somewhere that deals with touchscreen ...
3
votes
0answers
782 views

How to add custom menu items to system menu?

I'm wanting to write a few shell scripts which I can run from clicking their respective items from the system menu (with the power options). I cant seem to find anything online about adding items to ...
3
votes
0answers
70 views

How to run a program in its own, temporary, xdisplay (runx)?

For background I like to play some older games that really run better in super low resolutions and having the whole desktop switch to 320 x 400 is really not that great. I've gotten around this by ...
3
votes
0answers
76 views

How to trigger a script on entering/exiting a workspace?

This is regarding ubuntu 15.10. I have enabled workspaces, and would like unity launcher sidebar to show open application icon only if it was opened in the current workspace. To do so, I have already ...
3
votes
0answers
1k views

fswatch | while read | xargs running command twice

Thanks in advance for any advice I'm working on an fswatch command to launch a script when files hit the Downloads folder. fswatch --event Created Downloads/ | (while read x; do echo $x | xargs -0 ...
3
votes
1answer
401 views

How to install dogtail script recorder in ubuntu 14?

According to this tutorial, https://wiki.ubuntu.com/Testing/Automation/DogtailTutorial I should have 'Dogtail script recorder' installed in my system after install python-dogtail package. ...
3
votes
1answer
905 views

How to downgrade/unpatch bash for ubuntu 12.04 LTS to get back to the original vulnerable version of it?

I am using Ubuntu 12.04 LTS. I tried resolving the the shell-shock vulnerability of environment variables by updating bash. Is there any way to downgrade the bash and again try and demonstrate for the ...
3
votes
1answer
298 views

Bash Script for Dumping the Android Partition is not consistent

I really need your suggestion about my current problem. I am trying to dump the whole partitions on the Android with netcat. I have created 4 bash scripts for automation process. So, I only need to ...
3
votes
0answers
542 views

Ubuntu 12.04 LTS scripts in /if-up.d not executed

Since this morning have been trying to achieve something: System: Ubuntu 12.04 LTS, Network-Manager is not installed Goal: Every time, the eth0 network interface is started (if-up.d) we want to ...
3
votes
0answers
1k views

Unable to connect to X11 display. is $DISPLAY set? - Yes, it is

I'm trying to run this in my /etc/init.d/rc.local. I had to manually add the exit 0 because it wasn't there by default if that makes any difference. cd /home/john/xcape && ./xcape -e '...
3
votes
0answers
1k views

Using a keyboard shortcut to execute a script

Hello I am a linux newbie trying to set up a keyboard shortcut to execute a script I have. The script functions as desired, and is #!/bin/bash livestreamer twitch.tv/arteezy best This opens up VLC ...
3
votes
1answer
1k views

How to change shutdown script timeout?

I have a script running at shutdown of my server, it was added to rc.d scripts with update-rc.d local.shutdown stop 20 0 1 6 . The problem is that this script takes a few minutes to complete it's ...
3
votes
0answers
248 views

Activating USB audio with /etc/pm/sleep.d script that runs pacmd commands

Ubuntu annoyingly switches the device for audio input and output from my USB headset to the built-in sound card every time I log out, hibernate, or shut down my computer. This takes place even though "...
3
votes
2answers
183 views

Can I edit login script

Can I edit login script? For I want to restrict the user to only have 3 login attempts. If the user fails to login in after 3 attempts, the system must shutdown. Is this possible?
3
votes
2answers
3k views

How to automatically create `.m3u` (or other playlist file) for multiple directories supporting multiple file formats?

I want to create a .m3u (playlist) file for every folder that's inside a directory, automatically and save it inside that particular folder with the name of that particular folder? How to Create an ....
3
votes
1answer
681 views

Set default application using command line

How can I do right click > File > Properties > Open with > Set as default in the terminal? I created a java app and an installation script for it. I would like to run my app by double click. So I ...
3
votes
1answer
803 views

How to configure ccsm from the command line or a script?

THE GENERAL PROBLEM: I wish to change some settings of ccsm from the command line, or more precisely a script. I imagine there will be some arcane combination of gsettings or gconftool that does what ...
2
votes
2answers
39 views

Shell script - Ping address range then assign a down address to interface

We have a need for assigning IP addressees to raspberry pi's. I want to automate this with a script that can run at logon. The script would ping a range of IP addresses and the first IP address that ...
2
votes
0answers
42 views

why is if statement working on terminal but not as script

I am trying to make a script that checks if a service is running (sickchill in this case) and if not start it with systemctl. My code is working as intended if I execute it from the terminal, but when ...
2
votes
1answer
38 views

run a script if error prevents running any other script

Because of sync issues, my bash scripts sometimes lose run permissions. I have scripts hooked up to keyboard shortcuts, and sometimes I'm not sure if there's a lack of response from the shortcut ...
2
votes
0answers
41 views

How can I run a command after resuming from sleep?

I installed a fan control service (fancontrol). It's working perfectly, but there is an issue with suspend: when i wake up my computer, fans going to spin very fast, because fan control service ...
2
votes
1answer
93 views

Does Reboot command invoke scripts in /etc/rc0.d/ directory?

I need to kill some services when shutdown/reboot my Linux server, but I am not sure how Reboot command works. To my understanding, /etc/rc0.d/ scripts will be invoked when system is shutdown, while ...
2
votes
0answers
65 views

How to create service that will execute periodically bash script (with ssh connection)

I am having bash script that checks for ssh connection in lsof. In case it's down, it will open it once again. I found some information how to create service that starts periodically, but the ...
2
votes
0answers
30 views

How do I replicate this script being used on a Red Hat Vagrant box using a Ubuntu Vagrant box?

I have a Vagrant box running a Node.js app for internal use at work. It is currently running on a Red Hat 6.5 Linux Vagrant box but for reasons I need to migrate it to a Ubuntu 18 Vagrant box. The ...
2
votes
0answers
23 views

Lubuntu: autorun after GUI loads, either a script, or a desktop app (with a script)

I am trying to have Lubuntu run a script as soon as the desktop as loaded after logging in. Right now there is a desktop application for a user to double click that runs the script. I would rather ...

1
2 3 4 5
24