time-command or similar?
#1
Sun, 2017-10-15 18:09
strowi
-
- Offline
- 5 months 1 week ago
- 2017-10-15
Hi everyone,
i'm in the process of migrating our cron-container to alpine. We've been using a little helper script to measure some stats for the executed scripts much like mk-job from check_mk. This tool uses the 'time'-command (not the alias or similar) to output stats like this:
... /usr/bin/time -o "$OUTPUT_PATH/$IDENT.running" --append \ -f "exit_code %x real_time %E user_time %U system_time %S reads %I writes %O max_res_kbytes %M avg_mem_kbytes %K invol_context_switches %c vol_context_switches %w" "$@" ...
Does something similar exist in alpine?
greetings,
strowi
There doesn't seem to be a package in the repositories:
https://pkgs.alpinelinux.org/contents?file=time&path=&name=util-linux&branch=edge&repo=main&arch=armhf
However, Arch Linux has packaged it, here is the PKGBUILD & patches:
https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/time
Alpine's APKBUILDs are sufficiently similar that Arch's files can be used as a "cheat sheet" and template.
Official guide here:
https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package
Once the APKBUILD is written, use `abuild -r` to make the package and `apk add ~/packages/$dir/time*.apk` (where $dir is the build directory) to install it.
If it all works you could even submit the package to Alpine's testing repositories so everybody can use it.