2 # - added support for selinux
3 Summary: A periodical command scheduler which aims at replacing Vixie Cron
4 Summary(pl): Serwer okresowego uruchamiania poleceñ zastepuj±cy Vixie Crona
10 Source0: http://fcron.free.fr/archives/%{name}-%{version}.src.tar.gz
11 # Source0-md5: 73042f2666dff27444789d542bbcd607
13 Source2: cron.logrotate
14 Source3: cron.sysconfig
15 Source4: %{name}.crontab
19 URL: http://fcron.free.fr/
20 #BuildRequires: libselinux-devel
21 BuildRequires: pam-devel
22 BuildRequires: rpmbuild(macros) >= 1.159
24 Requires(pre): /usr/bin/getgid
25 Requires(pre): /usr/sbin/groupadd
26 Requires(post,preun): /sbin/chkconfig
27 Requires(post): fileutils
28 Requires(postun): /usr/sbin/groupdel
29 Requires: /bin/run-parts
30 Requires: psmisc >= 20.1
31 Provides: crontabs >= 1.7
33 Provides: group(crontab)
39 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
42 Fcron is a periodical command scheduler which aims at replacing Vixie
43 Cron, so it implements most of its functionalities. But fcron does not
44 assume that your system is running neither all the time nor regularly:
45 you can, for instance, tell fcron to execute tasks every x hours y
46 minutes of system up time or to do a job only once in a specified
47 interval of time. You can also set a nice value to a job, run it
48 depending on the system load average and much more !
51 Fcron jest serwerem okresowego uruchamiania poleceñ maj±cym za cel
52 zast±pienie Vixie Crona, posiadaj±cym zaimplementowane wiêkszo¶æ
53 spo¶ród jego funkcji. Jednak¿e fcron nie zak³ada, ¿e system dzia³a
54 ca³y czas, ani ¿e jest uruchamiany regularnie: mo¿na, na przyk³ad,
55 kazaæ fcronowi uruchamiaæ zadanie co ka¿de x godzin y minut od
56 uruchomienia systemu lub wykonywaæ zadanie dok³adnie raz w podanym
57 okresie czasu. Umo¿liwia równie¿ ustawianie warto¶ci nice dla zadania,
58 uruchamianie go w zale¿no¶ci od obci±¿enia systemu i du¿o wiêcej.
65 --with-spooldir=%{_var}/spool/cron \
66 --with-run-non-privileged=no \
67 --with-boot-install=no \
69 --with-username=crontab \
70 --with-groupname=crontab \
73 --with-boot-install=no
77 echo "#!/bin/sh" > script/user-group
80 rm -rf $RPM_BUILD_ROOT
81 install -d $RPM_BUILD_ROOT{/var/{log,spool/cron},%{_mandir}} \
82 $RPM_BUILD_ROOT/etc/{rc.d/init.d,logrotate.d,sysconfig} \
83 $RPM_BUILD_ROOT%{_sysconfdir}/{cron,cron.{d,hourly,daily,weekly,monthly},pam.d}
86 DESTDIR=$RPM_BUILD_ROOT \
87 DESTSBIN=$RPM_BUILD_ROOT%{_sbindir} \
88 DESTBIN=$RPM_BUILD_ROOT%{_bindir} \
89 DESTMAN=$RPM_BUILD_ROOT%{_mandir} \
95 ln -sf %{_bindir}/fcrontab $RPM_BUILD_ROOT%{_bindir}/crontab
96 mv -f $RPM_BUILD_ROOT%{_sbindir}/fcron $RPM_BUILD_ROOT%{_sbindir}/crond
98 #fix premission for rpmbuild
99 chmod +rw $RPM_BUILD_ROOT/usr/*bin/*
101 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/crond
102 install %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/cron
103 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/cron
104 install %{SOURCE4} $RPM_BUILD_ROOT/etc/cron.d/crontab
105 install %{SOURCE5} $RPM_BUILD_ROOT/etc/pam.d/fcron
106 install %{SOURCE6} $RPM_BUILD_ROOT/etc/fcron.conf
107 install %{SOURCE7} $RPM_BUILD_ROOT/etc/pam.d/fcrontab
109 #for a in fi fr id ja ko pl ; do
110 # if test -f $a/man1/crontab.1 ; then
111 # install -d $RPM_BUILD_ROOT%{_mandir}/$a/man1
112 # install $a/man1/crontab.1 $RPM_BUILD_ROOT%{_mandir}/$a/man1
114 # if test -f $a/man5/crontab.5 ; then
115 # install -d $RPM_BUILD_ROOT%{_mandir}/$a/man5
116 # install $a/man5/crontab.5 $RPM_BUILD_ROOT%{_mandir}/$a/man5
118 # if test -f $a/man8/cron.8 ; then
119 # install -d $RPM_BUILD_ROOT%{_mandir}/$a/man8
120 # install $a/man8/cron.8 $RPM_BUILD_ROOT%{_mandir}/$a/man8
121 # echo .so cron.8 > $RPM_BUILD_ROOT%{_mandir}/$a/man8/crond.8
125 touch $RPM_BUILD_ROOT/var/log/cron
127 cat > $RPM_BUILD_ROOT%{_sysconfdir}/cron/cron.allow << EOF
128 # cron.allow This file describes the names of the users which are
129 # allowed to use the local cron daemon
133 cat > $RPM_BUILD_ROOT%{_sysconfdir}/cron/cron.deny << EOF2
134 # cron.deny This file describes the names of the users which are
135 # NOT allowed to use the local cron daemon
139 rm -rf $RPM_BUILD_ROOT
142 if [ -n "`/usr/bin/getgid crontab`" ]; then
143 if [ "`/usr/bin/getgid crontab`" != "117" ]; then
144 echo "Error: group crontab doesn't have gid=117. Correct this before installing cron." 1>&2
148 echo "Adding group crontab GID=117."
149 /usr/sbin/groupadd -g 117 -r -f crontab
152 if [ -n "`/bin/id -u crontab 2>/dev/null`" ]; then
153 if [ "`/bin/id -u crontab`" != "134" ]; then
154 echo "Error: user crontab doesn't have uid=134. Correct this before installing %{name}." 1>&2
158 /usr/sbin/useradd -u 134 -r -d /var/spool/cron -s /bin/false -c "crontab User" -g crontab crontab 1>&2
162 if [ "$1" = "1" ]; then
163 if [ -d /var/spool/cron ]; then
164 for FILE in /var/spool/cron/*; do
165 mv -f $FILE $FILE.orig
166 USER=`basename $FILE`
167 chown crontab.crontab $FILE.orig
169 (test ! -z "$USER" && fcrontab -u $USER -z) > /dev/null 2>&1
171 if [ -f /var/spool/cron/root.orig ]; then
172 chmod 600 /var/spool/cron/root.orig
173 chown root.root /var/spool/cron/root.orig
178 if [ "$1" = "2" ]; then
179 for FILE in /var/spool/cron/*.orig; do
180 BASENAME=`basename $FILE`
181 USER=`echo "$BASENAME"| sed 's/.orig//'`
182 (test ! -z "$USER" && fcrontab -u $USER -z) > /dev/null 2>&1
186 /sbin/chkconfig --add crond
187 if [ -f /var/lock/subsys/crond ]; then
188 /etc/rc.d/init.d/crond restart >&2
190 echo "Run \"/etc/rc.d/init.d/crond start\" to start cron daemon."
195 chgrp crontab /var/log/cron
196 chmod 660 /var/log/cron
199 if [ "$1" = "0" ]; then
200 if [ -f /var/lock/subsys/crond ]; then
201 /etc/rc.d/init.d/crond stop >&2
203 /sbin/chkconfig --del crond
205 rm -f /var/spool/cron/systab*
206 for FILE in /var/spool/cron/*.orig; do
207 BASENAME=`basename $FILE`
208 USER="`echo "$BASENAME"| sed 's/.orig//'`"
209 mv -f $FILE /var/spool/cron/$USER >/dev/null 2>&1
210 chown $USER.crontab /var/spool/cron/$USER >/dev/null 2>&1
211 chmod 600 /var/spool/cron/$USER >/dev/null 2>&1
216 if [ "$1" = "0" ]; then
221 %triggerpostun -- vixie-cron <= 3.0.1-85
222 for i in `/bin/ls /var/spool/cron 2>/dev/null`
224 chown ${i} /var/spool/cron/${i} 2>/dev/null || :
226 /bin/chmod 660 /var/log/cron
227 /bin/chgrp crontab /var/log/cron
228 /bin/chmod 640 /etc/cron/cron.*
229 /bin/chgrp crontab /etc/cron/cron.*
231 %triggerpostun -- vixie-cron <= 3.0.1-73
232 if [ -f /etc/cron.d/cron.allow.rpmsave ]; then
233 mv -f /etc/cron.d/cron.allow.rpmsave /etc/cron/cron.allow
235 if [ -f /etc/cron.d/cron.allow ]; then
236 mv -f /etc/cron.d/cron.allow /etc/cron/cron.allow
238 if [ -f /etc/cron.d/cron.deny.rpmsave ]; then
239 mv -f /etc/cron.d/cron.deny.rpmsave /etc/cron/cron.deny
241 if [ -f /etc/cron.d/cron.deny ]; then
242 mv -f /etc/cron.d/cron.deny /etc/cron/cron.deny
245 %triggerpostun -- vixie-cron <= 3.0.1-70
246 if [ -f /etc/cron.allow ]; then
247 mv -f /etc/cron.allow /etc/cron/cron.allow
249 if [ -f /etc/cron.deny ]; then
250 mv -f /etc/cron.deny /etc/cron/cron.deny
253 %triggerpostun -- hc-cron
254 /sbin/chkconfig --del crond
255 /sbin/chkconfig --add crond
257 %triggerpostun -- hc-cron <= 0.14-12
258 for i in `/bin/ls /var/spool/cron 2>/dev/null`
260 chown ${i} /var/spool/cron/${i} 2>/dev/null || :
262 /bin/chmod 660 /var/log/cron
263 /bin/chgrp crontab /var/log/cron
264 /bin/chmod 640 /etc/cron/cron.*
265 /bin/chgrp crontab /etc/cron/cron.*
268 %defattr(644,root,root,755)
269 %doc doc/HTML doc/olddoc/{FAQ,CHANGES,README,THANKS,TODO}
270 %attr(0750,root,crontab) %dir %{_sysconfdir}/cron*
271 %attr(0644,root,crontab) %config(noreplace) /etc/cron.d/crontab
272 %attr(0640,root,crontab) %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/cron/cron.allow
273 %attr(0640,root,crontab) %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/cron/cron.deny
274 %attr(0640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/cron
275 %attr(0644,root,crontab) %config(noreplace) %verify(not md5 size mtime) /etc/pam.d/fcron
276 %attr(0644,root,crontab) %config(noreplace) %verify(not md5 size mtime) /etc/pam.d/fcrontab
277 %attr(0754,root,root) /etc/rc.d/init.d/crond
278 %config /etc/logrotate.d/cron
279 %attr(0640,root,crontab) %config(noreplace) /etc/fcron.conf
280 %attr(0755,root,root) %{_sbindir}/crond
281 %attr(6111,crontab,crontab) %{_bindir}/fcrontab
282 %attr(6111,crontab,crontab) %{_bindir}/crontab
283 %attr(4711,root,root) %{_bindir}/fcronsighup
284 %attr(6111,crontab,crontab) %{_bindir}/fcrondyn
287 #%%lang(fi) %{_mandir}/fi/man*/*
288 #%%lang(fr) %{_mandir}/fr/man*/*
289 #%%lang(id) %{_mandir}/id/man*/*
290 #%%lang(ja) %{_mandir}/ja/man*/*
291 #%%lang(ko) %{_mandir}/ko/man*/*
292 #%%lang(pl) %{_mandir}/pl/man*/*
294 %attr(1730,root,crontab) /var/spool/cron
295 %attr(0660,root,crontab) %ghost /var/log/cron