简体   繁体   中英

Couldn't package a cron job using sbt-native-packager when building a deb bundle

I am trying to package a cron as part of my debian package ( https://github.com/indykish/megam_akka.git ).

The debian package is built using the sbt-native-packager. I placed the cron script inside my bin directory as here https://github.com/indykish/megam_akka/blob/master/bin/megamherk.cron.d

I changed my build.sbt to pickup the megamher.cron.d as here https://github.com/indykish/megam_akka/blob/master/build.sbt

I have attached the snippet of code here:

 linuxPackageMappings in Debian <+= (baseDirectory) map { bd =>
 (packageMapping((bd / "bin/herk_stash") -> "/usr/share/megamherk/bin/herk_stash")
 withUser "root" withGroup "root" withPerms "0755")
 }

linuxPackageMappings in Debian <+= (baseDirectory) map { bd =>
(packageMapping((bd / "bin/megamherk.cron.d") -> "/etc/cron.d/megamherk")
withUser "root" withGroup "root" withPerms "0755")
}

I ran:

sbt clean compile

sbt dist:dist

sbt debian:packageBin

The generated debian bundle inside the target directory doesn't have the cron bundled.

I referred this debian documentation ( http://www.debian.org/doc/manuals/maint-guide/dother.en.html#crond )

Am I missing something here ? How do I make sbt-native-package pickup a cron job ?

The easiest way to package simple files is to use the default directory structure.

src/linux/...

In your case you would put your file in

src/linux/etc/cron.d/megamherk

You locale settings will be reapplied. So if megamherk is executable it will stay executable.

If this doesn't work for you open a ticket with a small test case.

cheers, Muki

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM