Description of problem: there are few problems with initscript of service: based on document: https://fedoraproject.org/wiki/Packaging/SysVInitScript * /var/run/cyrus-imapd.pid doesn't exist * insufficient rights, there should be returncode 4 # su testuserqa -c "service $SERVICE restart"; echo $? now: 0 expected: 4 * there arent implemented LSB compilant functions which are requred: usage * nonexist function should have returncode 3: # service $SERVICE noexistop; echo $? now: 1 expected: 3
:: [ LOG ] :: >>>>>>>>> service start :: [ PASS ] :: Service must start without problem :: [ PASS ] :: Then Status command :: [ PASS ] :: Already started service :: [ PASS ] :: Again status command :: [ LOG ] :: >>>>>>>>> service restart :: [ PASS ] :: Restarting of service :: [ PASS ] :: Status command :: [ LOG ] :: >>>>>>>>> service stop :: [ PASS ] :: Stopping service :: [ PASS ] :: Status of stopped service :: [ PASS ] :: Stopping service again :: [ PASS ] :: Status of stopped service :: [ LOG ] :: >>>>>>>>> pid file :: [ FAIL ] :: File /var/run/dovecot.pid should exist :: [ PASS ] :: Running 'echo 666666 > /var/run/dovecot.pid' :: [ FAIL ] :: Existing pid file, but service not started (Expected 1, got 3) :: [ LOG ] :: >>>>>>>>> lock file :: [ PASS ] :: File /var/lock/subsys/dovecot should exist :: [ PASS ] :: Running 'touch /var/lock/subsys/dovecot' :: [ PASS ] :: Existing lock file, but service not started :: [ LOG ] :: >>>>>>>>> insufficient rights :: [ PASS ] :: Starting service for restarting under nonpriv user :: [ FAIL ] :: Insufficient rights, restarting resrvice under nonprivileged user must fail (Expected 4, got 0) :: [ LOG ] :: >>>>>>>>> operations :: [ PASS ] :: Service have to implement start function :: [ PASS ] :: Service have to implement restart function :: [ PASS ] :: Service have to implement status function :: [ FAIL ] :: Service have to implement usage function (Expected 0, got 2) :: [ PASS ] :: Service have to implement condrestart function :: [ PASS ] :: Service have to implement try-restart function :: [ PASS ] :: Service have to implement reload function :: [ PASS ] :: Service have to implement force-reload function :: [ LOG ] :: >>>>>>>>> nonexist operations :: [ PASS ] :: Testing proper return code when nonexisting function :: [ LOG ] :: >>>>>>>>> invalid arguments :: [ PASS ] :: When no arguments added to service, it must fail with proper return code
(In reply to comment #1) > :: [ FAIL ] :: File /var/run/dovecot.pid should exist dovecot uses /var/run/dovecot/master.pid this file is heavily referenced from documentation and even dovecot sources and plugins -> I'm not going to change this. > :: [ PASS ] :: Running 'echo 666666 > /var/run/dovecot.pid' > :: [ FAIL ] :: Existing pid file, but service not started (Expected 1, > got 3) your test used wrong pid file, if you use correct file /var/run/dovecot/master.pid , it will return 1 as expected -> this works > :: [ FAIL ] :: Insufficient rights, restarting resrvice under nonprivileged > user must fail (Expected 4, got 0) -> fixed > :: [ FAIL ] :: Service have to implement usage function (Expected 0, got > 2) -> fixed
(In reply to comment #2) > (In reply to comment #1) > > :: [ FAIL ] :: File /var/run/dovecot.pid should exist > > dovecot uses /var/run/dovecot/master.pid > > this file is heavily referenced from documentation and even dovecot sources and > plugins > > -> I'm not going to change this. Okay, why not, but almost all service use exact path /var/run/nameofservice.pid There is option to add second pid file used mainly for services. because then it will be predictable. > > > :: [ PASS ] :: Running 'echo 666666 > /var/run/dovecot.pid' > > :: [ FAIL ] :: Existing pid file, but service not started (Expected 1, > > got 3) > > your test used wrong pid file, if you use correct file > /var/run/dovecot/master.pid , it will return 1 as expected Yep, viz above. It is not clear have pid file in other dir than other services do. > > -> this works > > > :: [ FAIL ] :: Insufficient rights, restarting resrvice under nonprivileged > > user must fail (Expected 4, got 0) > > -> fixed Thanks > > > :: [ FAIL ] :: Service have to implement usage function (Expected 0, got > > 2) > > -> fixed Thanks There is needed more strict rules in LSB pseudo-standard. Now it is based on anyone interpretation.