{"action":"created","issue":{"url":"https://api.github.com/repos/erigones/esdc-factory/issues/89","repository_url":"https://api.github.com/repos/erigones/esdc-factory","labels_url":"https://api.github.com/repos/erigones/esdc-factory/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/erigones/esdc-factory/issues/89/comments","events_url":"https://api.github.com/repos/erigones/esdc-factory/issues/89/events","html_url":"https://github.com/erigones/esdc-factory/issues/89","id":269965469,"number":89,"title":"Add custom postboot SMF user scripts","user":{"login":"YanChii","id":5031852,"avatar_url":"https://avatars2.githubusercontent.com/u/5031852?v=4","gravatar_id":"","url":"https://api.github.com/users/YanChii","html_url":"https://github.com/YanChii","followers_url":"https://api.github.com/users/YanChii/followers","following_url":"https://api.github.com/users/YanChii/following{/other_user}","gists_url":"https://api.github.com/users/YanChii/gists{/gist_id}","starred_url":"https://api.github.com/users/YanChii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YanChii/subscriptions","organizations_url":"https://api.github.com/users/YanChii/orgs","repos_url":"https://api.github.com/users/YanChii/repos","events_url":"https://api.github.com/users/YanChii/events{/privacy}","received_events_url":"https://api.github.com/users/YanChii/received_events","type":"User","site_admin":false},"labels":[{"id":574804244,"url":"https://api.github.com/repos/erigones/esdc-factory/labels/SmartOS","name":"SmartOS","color":"c5def5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/erigones/esdc-factory/milestones/3","html_url":"https://github.com/erigones/esdc-factory/milestone/3","labels_url":"https://api.github.com/repos/erigones/esdc-factory/milestones/3/labels","id":2602459,"number":3,"title":"2.7.0","description":"","creator":{"login":"dn0","id":3155465,"avatar_url":"https://avatars1.githubusercontent.com/u/3155465?v=4","gravatar_id":"","url":"https://api.github.com/users/dn0","html_url":"https://github.com/dn0","followers_url":"https://api.github.com/users/dn0/followers","following_url":"https://api.github.com/users/dn0/following{/other_user}","gists_url":"https://api.github.com/users/dn0/gists{/gist_id}","starred_url":"https://api.github.com/users/dn0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dn0/subscriptions","organizations_url":"https://api.github.com/users/dn0/orgs","repos_url":"https://api.github.com/users/dn0/repos","events_url":"https://api.github.com/users/dn0/events{/privacy}","received_events_url":"https://api.github.com/users/dn0/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":2,"state":"open","created_at":"2017-06-24T20:37:58Z","updated_at":"2017-10-31T13:51:10Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2017-10-31T13:51:10Z","updated_at":"2017-10-31T14:00:00Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Add 3 SMF services that will run user scripts at/after boot.\r\n1. pre-network-rc.d\r\n2. pre-vm-rc.d\r\n3. post-vm-rc.d\r\n\r\n**pre-network-rc.d**\r\n- starts before networking is up (before `network/physical`)\r\n- location: `/opt/custom/method/pre-network`\r\n- runs scripts from: `/opt/custom/etc/rc.d-pre-network`\r\n\r\n**pre-vm-rc.d**\r\n- starts before `svc:/system/zones:default` and `svc:/system/smartdc/vmadmd:default`\r\n- suitable for running iSCSI and other external (Z)FS mounts\r\n- location: `/opt/custom/method/pre-vm`\r\n- runs scripts from: `/opt/custom/etc/rc.d-pre-vm`\r\n\r\n**post-vm-rc.d**\r\n- starts after `svc:/system/zones:default` and `svc:/system/smartdc/vmadmd:default`\r\n- suitable for tasks that interact with booted VMs\r\n- equivalent of rc.local\r\n- location: `/opt/custom/method/post-vm`\r\n- runs scripts from: `/opt/custom/etc/rc.d-post-vm`\r\n\r\nProposed names and paths are subject to discussion.\r\n\r\nScripts from `rc.d*` directories are run in alphabetical order at boot (with `start` parameter) and in reverse order during shutdown (with `stop` parameter). Therefore it is recommended to name the scripts with starting number. (e.g. `001-mount-iscsi.sh`).\r\nOnly executable files with `.sh` suffix will be run.\r\n"},"comment":{"url":"https://api.github.com/repos/erigones/esdc-factory/issues/comments/340770754","html_url":"https://github.com/erigones/esdc-factory/issues/89#issuecomment-340770754","issue_url":"https://api.github.com/repos/erigones/esdc-factory/issues/89","id":340770754,"user":{"login":"YanChii","id":5031852,"avatar_url":"https://avatars2.githubusercontent.com/u/5031852?v=4","gravatar_id":"","url":"https://api.github.com/users/YanChii","html_url":"https://github.com/YanChii","followers_url":"https://api.github.com/users/YanChii/followers","following_url":"https://api.github.com/users/YanChii/following{/other_user}","gists_url":"https://api.github.com/users/YanChii/gists{/gist_id}","starred_url":"https://api.github.com/users/YanChii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YanChii/subscriptions","organizations_url":"https://api.github.com/users/YanChii/orgs","repos_url":"https://api.github.com/users/YanChii/repos","events_url":"https://api.github.com/users/YanChii/events{/privacy}","received_events_url":"https://api.github.com/users/YanChii/received_events","type":"User","site_admin":false},"created_at":"2017-10-31T14:00:00Z","updated_at":"2017-10-31T14:00:00Z","author_association":"CONTRIBUTOR","body":"1. We should include a sample dummy rc.d script.\r\n\r\n2. The mount-iscsi script can be prepared in the `pre-vm-rc.d` as an example.\r\nExample `001-mount-iscsi.sh`:\r\n```\r\n#!/bin/sh -e\r\n\r\nmount_zpool()\r\n{\r\n    mypool=\"$1\"\r\n    if ! /usr/sbin/zpool list -Ho name | grep -q \"^${mypool}$\"; then\r\n        /usr/sbin/zpool import \"${mypool}\"\r\n    fi\r\n}\r\n\r\nstart()\r\n{\r\n    /usr/sbin/iscsiadm modify initiator-node -N iqn.2001-03.com.sun:01:e00000000000.6695a9be\r\n    /usr/sbin/iscsiadm add discovery-address 10.20.30.41\r\n    /usr/sbin/iscsiadm add discovery-address 10.20.30.42\r\n    /usr/sbin/iscsiadm modify discovery -t enable\r\n    mount_zpool iscsipool1\r\n    mount_zpool iscsipool2\r\n}\r\n\r\nstop()\r\n{\r\n    /usr/sbin/zpool export iscsipool1\r\n    /usr/sbin/zpool export iscsipool2\r\n    /usr/sbin/iscsiadm remove discovery-address 10.20.30.41\r\n    /usr/sbin/iscsiadm remove discovery-address 10.20.30.42\r\n    /usr/sbin/iscsiadm modify discovery -t disable\r\n}\r\n\r\ncase \"$1\" in\r\n  start)\r\n    start\r\n    ;;\r\n  stop)\r\n    stop\r\n    ;;\r\n  refresh)\r\n    exit 0\r\n    ;;\r\n  restart)\r\n    stop\r\n    start\r\n    ;;\r\n  *)\r\n    echo \"Usage: $0 {start|stop|restart|refresh}\"\r\nesac\r\n```"}}
{"actor":{"display_login":"YanChii"}}