Questions tagged [hook]
The hook tag has no usage guidance.
46
questions
0
votes
0
answers
54
views
Is there a hook in the copy/paste mechanism where one could insert arbitrary editing?
Is there any mechanism for inserting code between the copy/cut and the paste mechanism?
For instance, if I cut or copy text that contains:
… We run unix on our laptops. …
I'd like it to be pasted as:...
0
votes
1
answer
61
views
Is there a way to disallow a certain combination of commands and options?
Say, I create a new repo, and try to commit. Git shows me
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your ...
2
votes
0
answers
310
views
Difference in behavior when hooking a library function via LD_PRELOAD on Ubuntu and CentOS [closed]
There is a hook function socketHook.c that intercepts socket() calls:
#include <stdio.h>
int socket(int domain, int type, int protocol)
{
printf("socket() has been intercepted!\n");...
0
votes
0
answers
27
views
Using a script output as a file (not to a file)
I have two programs using the same configuration (chatty + pidgin) in ~/.purple but I wish to separate them into different configuration folders.
My goal is to have chatty use only chatty's ...
1
vote
1
answer
261
views
Arch Boot Hook: Allocation zramctl fails to allocate
OS Version: 5.9.14-arch1-1 Kernel
I am trying to figure out how I can load the whole / directory into the RAM when starting up.
I found a little helper here:
https://github.com/arcmags/ramroot
So, ...
0
votes
1
answer
240
views
Execute function in bash on every keystroke in interactive shell
I would like to run a function every time a user presses a key in an interactive bash shell.
I am wondering if bash has anything built in like the self-insert function in zsh?
Alternatively, I am ...
0
votes
0
answers
106
views
Does linux support the functionality provided by Windows HKEY_CLASSES_ROOT URL protocol trigger?
This windows registry magic:
[HKEY_CLASSES_ROOT\shotgun]
@="URL:example Protocol" # <---- URL for this example is example.com
"URL Protocol"=""
[HKEY_CLASSES_ROOT\...
0
votes
2
answers
267
views
rclone mount webdav whenever a certain application is started
I'd like to automatically mount a nextcloud directory (webdav) with my keepass-database in it using rclone whenever I start KeepassXC and unmount it after closing Keepass. Is there any way to do this (...
1
vote
0
answers
200
views
Identify empty VALUE in XML files and return exit command? [closed]
For instance, I have an XML file with the below content and the "NAME" Author and Assignee(s) have empty "VALUE". The main aim is to implement a check that can be applied to find ...
0
votes
1
answer
248
views
Zsh Hook Function Definitions as arguments
I would like to know if it's possible to define hook functions as arguments or env var when launching zsh instead of defining it in .zshrc or prompt.
For example ;
zsh -F preexec() { date } -F chpwd() ...
4
votes
0
answers
188
views
How to run script when switching to specific (already logged in) user
There's plenty of info out there on how to run a script at login (add it to .xprofile etc.), but I'm looking for a solution that will run a script/command not just at login but also every time a ...
0
votes
0
answers
794
views
How to add crontab task by reboot / poweroff / poweron pc?
I have next record in crontab -e, running with user root.
@reboot /usr/bin/curl --silent --insecure -v -X GET https://<myserver_with_hook>?key=9d722304320de0b074d8da74bf680874&mes='nik-pc ...
0
votes
1
answer
426
views
Tmux hook after-source-file running but not displaying message
I want to write a hook in tmux to show a message that reports the config has been reloaded. Here is my code:
#binding a button to reload this config file
bind r source-file ~/.tmux.conf
#set hook to ...
-1
votes
1
answer
2k
views
Capture output of a command, process it and ONLY then output to terminal
I would like to capture the stdout (as sent to a terminal), and perform some processing after it is output on the terminal (for the user).
I want to know how to grab the output, process and make ...
4
votes
1
answer
645
views
How to use debuild hooks (--signing-hook-foo etc)
The man page isn't clear on that.
How would I use a signing hook? Especially using the parameter without the config file.
What is the meaning of foo in the documentation? For example in --signing-...
0
votes
1
answer
80
views
Thunderbird overloads my HDD in large operations, what to do?
If I do operations in Thunderbird with many (thousands of) mails, I hear a crashing voice from my HDDs. It sounds really not beautiful.
It happens only if I do something with a lot of mails (for ...
2
votes
0
answers
376
views
how to run a script before execute a dbus-send command?
I have the following problem: on lubuntu 16.04 I can send the laptop to sleep (suspend on RAM) using a hook script to switch to a virtual teminal before to suspend and reswitching out from a vt after ...
2
votes
0
answers
569
views
Is there any hook for isc-dhcp-server returning the DHCPACK to client? [closed]
I would like to run a script in the server after the isc-dhcp-server send the DHCPACK packet to client.
Only now I get it solution is that running a script to retrieve the dhcp log, but it is not ...
3
votes
0
answers
1k
views
Hooking sys_execve on Linux kernel 4.6 or higher
Kernels lower than 4.6 use assembly stubs to harden the hooking of critical system calls like fork, clone, exec etc. Particularly speaking for execve, the following snippet from Kernel-4.5 shows entry ...
0
votes
1
answer
301
views
Follow files execution by a kernel module [closed]
I'm currently doing some project of secure the kernel with syscall hooking and logs...
Now I've done hooking read, and socket system calls, and when I tried to do the same thing with execve (to follow ...
2
votes
2
answers
2k
views
Copy kernel images after kernel update
I am using ArchLinux on a machine using systemd-boot and UEFI to boot the system. When I receive a new kernel update, the new kernel get's created in my /boot , but the UEFI-Boot Partition is mounted ...
5
votes
3
answers
859
views
Inspect IO operations on FreeBSD system
I would know is there any way to inspect/intercept IO operations on FreeBSD.
Like ktrace but if I don't know the process (which takes some big time for example).
1
vote
2
answers
1k
views
When gitlab says make a file executable what exactly do they mean?
Gitlab says "Make the hook file executable and make sure it's owned by git" , but I read here that a file can be executable by owner, group, world. So which one do they mean?
Right now I am ...
0
votes
1
answer
1k
views
Proxmox hook for VMs
We have Proxmox installation. We want to execute a command after new VM was added. It is required for QEMU port redirection since setting redir option is not avaialble on GUI: qm set 102 -args "--...
1
vote
0
answers
1k
views
'gnome-screensaver-command -l' doesn't work when called from '/etc/pm/sleep.d'-script
I am using Archlinux and trying to let my notebook lock the screen via the instructions given on wiki.archlinux.org before it suspends.
Calling gnome-screensaver-command -l only locks my screen, when ...
1
vote
0
answers
1k
views
How to change the order of HOOKS in debian iniramfs configuration?
Hello I installed Archlinux to learn and now I'm insalling Debian but the initramfs setup is quite different from the mkinitcpio from Arch.
My question is : where do I find the order in which the ...
0
votes
1
answer
4k
views
dhclient enter/exit hooks to update resolv.conf
I would want to append the below line to resolv.conf of all servers in our aws env and make sure it doesn't get overwritten
options timeout:1 attempts:1 rotate
I came across dhclient enter and exit ...
3
votes
0
answers
288
views
Any way to specify process to call on Linux when OOM activates?
On my embedded system I'd like to record when the system OOM killer actives, e.g. by setting an env. variable in u-boot. Is there any way to specify a hook function to call on the OOM event?
1
vote
0
answers
67
views
Can I add a hook in openbox
The idea is to set per application keyboard shortcut. A hook after that application window get focus and before it's lost focus is needed to switch the keybinding.
This question is related to
https://...
8
votes
5
answers
7k
views
How to run a command before download with apt-get?
How can I run a command before apt-get starts to download a package?
I know about the dpkg pre-invoke hook ( hook a script to apt-get ), but that seems to be run after the download.
$ apt-get update
...
1
vote
2
answers
256
views
dhcp without dns: ping `hostname` not working. Auto add hostname to /etc/hosts?
On RHEL 6.5 how to make my own hostname locally resolvable, if my ip address is dynamic and not registered in DNS?
I know, it's possible to add dhcp hook scripts. Is there a similar way to hook the ...
3
votes
2
answers
1k
views
Dpkg env variable DPKG_HOOK_ACTION is not set in hook script
According to man dpkg I can use DPKG_HOOK_ACTION to get the current dpkg action being run in my dpkg hook script
--pre-invoke=command
--post-invoke=command
Set an invoke hook command to be run ...
12
votes
3
answers
2k
views
How can I run a command in bash after any change in $PWD?
zsh provides some nice hook functions, including chpwd for running a function after the user changes directories.
# zsh only
function greet() { echo 'hi'; }
chpwd_functions+=("greet")
cd .. # hi
...
1
vote
1
answer
4k
views
gphoto2 hook scripts - a guide?
I posted this on raspberrypi.stackexchange but was directed here. I'm new to Linux / Unix, and I'm trying to get a tether / display script going with gphoto2.
gphoto2 --capture-tethered --hook-...
4
votes
2
answers
1k
views
Falling to git checkout on non-found bash commands
When I type (in bash) a command which linux does not find, it usually does something like this:
$ x
x: command not found
but when I type a command which is not found but which is similar in some ...
5
votes
4
answers
2k
views
Run command when temperature exceeds threshold, without daemon
I need to run a specific command if my laptop gets too hot (for example, send a STOP signal to Firefox or Virtualbox in order to prevent my laptop from shutting down violently and damaging my hard ...
6
votes
2
answers
6k
views
Encrypt hook in mkinitcpio.conf for full system encryption USB drive Arch install
I have installed Arch Linux on a USB drive with full system encryption using LUKS. The Arch wiki as usual walked me through almost everything. The only issue I ran into was using setting up the hooks ...
1
vote
1
answer
2k
views
Forcing keys to run bash scripts
Is it possible to define bash scripts for all keys on keyboard so that by pressing any key the bash script for that key will be run?
The scripts may do anything, for instance they may save the key ...
1
vote
0
answers
1k
views
Can I install a sync completion hook with rsync daemon?
Like hooks in svn or git, can I install a server-side hook script for rsync daemon? For sync completion event.
I am using FreeBSD9/rsyncd.
3
votes
1
answer
4k
views
Set environment variable for all of tmux shells when gnome-sessions gets restarted
To solve this problem, I need to set the environment variable DBUS_SESSION_BUS_ADDRESS for all shells inside tmux every time I restart gnome without restarting tmux (this is often). How can I best ...
1
vote
1
answer
2k
views
Trigger action each time a file is modified [duplicate]
Possible Duplicate:
Can a bash script be hooked to a file?
Is it possible to mount a mechanism to a file to perform an action (e.g. mark the change in some log file and such) each time the file ...
2
votes
1
answer
2k
views
How to preload my .so every time an application executes?
I've successfully used a hook under Linux with this article: http://hackerboss.com/overriding-system-functions-for-fun-and-profit/
Now I want to make my .so file load every time espeak loads up, no ...
9
votes
3
answers
9k
views
How to execute a script on gdm login automatically for all users?
What file should I modify to execute some instructions when any user logs in through gdm?
I tried /etc/bashrc but that is executed ony when starting bash (and each time an xterm is open). I'd like to ...
1
vote
0
answers
257
views
How can I make scripts run when a file/directory changes in Linux (like Mac OS X’s launchd)? [duplicate]
Possible Duplicate:
Can a bash script be hooked to a file?
On Mac OS X, there’s a handy daemon called launchd which (amongst other things) allows you to have scripts run when files or directories ...
19
votes
2
answers
12k
views
Ssh login hook?
Is there a way to run a script/command every time a user connects using ssh? Can it be configured globally (i.e run the script when any user login)?
I came across this question on Identica, but there ...
32
votes
3
answers
4k
views
Can a bash script be hooked to a file?
I want a script to sleep unless a certain file is modifed/deleted (or a file created in a certain directory, or ...). Can this be achieved in some elegant way? The simplest thing that comes to my mind ...