Skip to content

Instantly share code, notes, and snippets.

@MillionthOdin16
Created November 20, 2024 02:57
Show Gist options
  • Save MillionthOdin16/ca432448731adc42464808f178bc9281 to your computer and use it in GitHub Desktop.
Save MillionthOdin16/ca432448731adc42464808f178bc9281 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Copyright (c) 2021-2024 tteck
# Author: tteck (tteckster)
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y curl sudo mc
msg_ok "Installed Dependencies"
msg_info "Installing NCID"
$STD apt-get install -y ncid ncid-client
msg_ok "Installed NCID"
msg_info "Configuring NCID"
# Ensure the log directory exists
mkdir -p /var/log/ncid
touch /var/log/ncid/ncid.log
chown ncid:ncid /var/log/ncid/ncid.log
# Sample NCID configuration
cat <<EOF >/etc/ncid/ncidd.conf
# Configuration file for NCID
# Log caller ID information
set cidlog = /var/log/ncid/ncid.log
# Listen on all network interfaces
set listen = all
# Caller ID server port
set port = 3333
EOF
# Enable and start the NCID server
systemctl enable -q --now ncidd.service
msg_ok "Configured and Started NCID Server"
msg_info "Creating Custom Service for NCID Client (Optional)"
# Optional: Set up an NCID client auto-start service
cat <<EOF >/etc/systemd/system/ncid-client.service
[Unit]
Description=NCID Client Service
After=network.target
[Service]
ExecStart=/usr/bin/ncid
Restart=on-failure
User=ncid
Group=ncid
[Install]
WantedBy=default.target
EOF
# Reload systemd to recognize the new service
systemctl daemon-reload
# Enable and start the optional NCID client service
systemctl enable -q --now ncid-client.service
msg_ok "Created and Started NCID Client Service"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment