View | Details | Raw Unified | Return to bug 245195
Collapse All | Expand All

(-)sysutils/checkrestart/Makefile (-2 / +9 lines)
Lines 2-8 Link Here
2
2
3
PORTNAME=	checkrestart
3
PORTNAME=	checkrestart
4
DISTVERSIONPREFIX=	v
4
DISTVERSIONPREFIX=	v
5
DISTVERSION=	0.4.0
5
DISTVERSION=	0.5.0
6
CATEGORIES=	sysutils
6
CATEGORIES=	sysutils
7
7
8
MAINTAINER=	tom@hur.st
8
MAINTAINER=	tom@hur.st
Lines 14-24 Link Here
14
USE_GITHUB=	yes
14
USE_GITHUB=	yes
15
GH_ACCOUNT=	Freaky
15
GH_ACCOUNT=	Freaky
16
16
17
SUB_FILES=	checkrestart
18
17
PLIST_FILES=	bin/checkrestart \
19
PLIST_FILES=	bin/checkrestart \
18
		share/man/man1/checkrestart.1.gz
20
		share/man/man1/checkrestart.1.gz \
21
		etc/periodic/daily/checkrestart
19
22
23
PERIODIC_DAILY=	etc/periodic/daily
24
20
do-install:
25
do-install:
21
	${INSTALL_PROGRAM} ${WRKSRC}/checkrestart ${STAGEDIR}${PREFIX}/bin
26
	${INSTALL_PROGRAM} ${WRKSRC}/checkrestart ${STAGEDIR}${PREFIX}/bin
22
	${INSTALL_MAN} ${WRKSRC}/checkrestart.1 ${STAGEDIR}${MAN1PREFIX}/share/man/man1
27
	${INSTALL_MAN} ${WRKSRC}/checkrestart.1 ${STAGEDIR}${MAN1PREFIX}/share/man/man1
28
	@${MKDIR} ${STAGEDIR}${PREFIX}/${PERIODIC_DAILY}
29
	${INSTALL_SCRIPT} ${WRKDIR}/checkrestart ${STAGEDIR}${PREFIX}/${PERIODIC_DAILY}
23
30
24
.include <bsd.port.mk>
31
.include <bsd.port.mk>
(-)sysutils/checkrestart/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1584926860
1
TIMESTAMP = 1585601339
2
SHA256 (Freaky-checkrestart-v0.4.0_GH0.tar.gz) = 9c578b7f0c881a10bea040da2c8525c2132bb47f1d85ca05ba6f6a9c6e61b1b4
2
SHA256 (Freaky-checkrestart-v0.5.0_GH0.tar.gz) = c37f40ad618d978fe413c71c367af5aefaeb1d600d72725294df8b3523e20e9c
3
SIZE (Freaky-checkrestart-v0.4.0_GH0.tar.gz) = 5306
3
SIZE (Freaky-checkrestart-v0.5.0_GH0.tar.gz) = 5659
(-)sysutils/checkrestart/files/checkrestart.in (+69 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
if [ -r /etc/defaults/periodic.conf ]; then
4
    . /etc/defaults/periodic.conf
5
    source_periodic_confs
6
fi
7
8
: "${daily_checkrestart_enable:=NO}"
9
: "${daily_checkrestart_weekdays:=1234567}" # Days of the week to run, Monday=1
10
: "${daily_checkrestart_users:=}"           # User names or IDs to check
11
: "${daily_checkrestart_jails:=}"           # Jail names or IDs to check
12
: "${daily_checkrestart_procs:=}"           # Process names or IDs to check
13
14
checkrestartcmd=/usr/local/bin/checkrestart
15
hflag=""
16
rc=0
17
18
export COLUMNS=80
19
20
checkrestart() {
21
    local result
22
    result="$(${checkrestartcmd} ${hflag} "$@" -- ${daily_checkrestart_procs} 2>&1)"
23
    if [ "$result" ]; then
24
        echo "${result}"
25
        rc=3
26
    fi
27
    hflag="-H"
28
}
29
30
checkrestart_each_user() {
31
    if [ -n "${daily_checkrestart_users}" ]; then
32
        for user in ${daily_checkrestart_users}; do
33
            checkrestart -u "${user}" "$@"
34
        done
35
    else
36
        checkrestart "$@"
37
    fi
38
}
39
40
checkrestart_start() {
41
    if [ -n "${daily_checkrestart_jails}" ]; then
42
        for jail in ${daily_checkrestart_jails}; do
43
            checkrestart_each_user -j "${jail}"
44
        done
45
    else
46
        checkrestart_each_user
47
    fi
48
}
49
50
checkday() {
51
    if echo "${daily_checkrestart_weekdays}" | grep -vq '^[1-7, ]*$'; then
52
        echo "daily_checkrestart_weekdays must have values 1-7"
53
        exit 2
54
    fi
55
56
    echo "${daily_checkrestart_weekdays}" | grep -Fq "$(date +%u)"
57
}
58
59
case "${daily_checkrestart_enable}" in
60
    [Yy][Ee][Ss])
61
    if checkday; then
62
        echo
63
        echo 'Checking for stale processes:'
64
        checkrestart_start
65
    fi
66
    ;;
67
esac
68
69
exit $rc
(-)sysutils/checkrestart/pkg-message (+16 lines)
Line 0 Link Here
1
[
2
{ type: install,
3
  message: <<EOM
4
In order to enable periodic(8) checks, set the following in /etc/periodic.conf
5
6
# Required
7
daily_checkrestart_enable="YES"
8
9
# Optional
10
daily_checkrestart_weekdays="1 4"     # only run on Monday and Thursday
11
daily_checkrestart_jails="0 web"      # limit to jails 0 and web
12
daily_checkrestart_users="root www"   # limit to root and www users
13
daily_checkrestart_procs="smbd httpd" # limit to samba and httpd
14
EOM
15
}
16
]

Return to bug 245195