From e6853bb6046fe24f818f174546d9d5fa75558a95 Mon Sep 17 00:00:00 2001 From: wowaname Date: Wed, 14 Sep 2016 00:20:12 +0000 Subject: [PATCH] add scripts/sighup.pl --- scripts/sighup.pl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 scripts/sighup.pl diff --git a/scripts/sighup.pl b/scripts/sighup.pl new file mode 100644 index 0000000..4647ada --- /dev/null +++ b/scripts/sighup.pl @@ -0,0 +1,22 @@ +use strict; +use warnings; + +no strict 'subs'; + +my $SCRIPT_NAME = 'sighup'; +my $SCRIPT_AUTHOR = 'The Krusty Krab '; +my $SCRIPT_VERSION = '1.0'; +my $SCRIPT_LICENCE = 'Public domain'; +my $SCRIPT_DESC = 'Reload config on SIGHUP'; + +if (weechat::register($SCRIPT_NAME, $SCRIPT_AUTHOR, $SCRIPT_VERSION, + $SCRIPT_LICENCE, $SCRIPT_DESC, '', '')) { + weechat::hook_signal('signal_sighup', 'cb_sighup', ''); +} + +sub cb_sighup { + weechat::command('', '/reload'); + + return weechat::WEECHAT_RC_OK_EAT; +} +